Both Pd and Ru are important elements in electrochemistry. However, Pd–Ru nanoparticle (NP) alloys are rarely reported so far, owing to the limitations described by Hume-Rothery. Herein, we successfully synthesized Pd–Ru NP alloys over the whole composition range using a facile atomic-diffusion-based strategy, and we carefully investigated the corresponding formation mechanism. For the first time, we confined the size of all alloy NPs at 3–5 nm, which is favorable in direct formic acid fuel cells. Experimental data indicate that the core-level binding energy of Pd positively shifts as a result of electron transfer from Pd to Ru. Such an electronic effect can effectively tune the adsorption intensity of reactive molecules during electrocatalysis. Driven by all these effects, these Pd–Ru alloys are highly active and stable towards formic acid oxidation. Composition–activity study further indicates that Pd60Ru40 exhibits the best mass activity, which is 4.1 times higher than that of commercial Pd/C.