The electrocatalytic CO2 reduction is a promising path toward the carbon-neutral goal but remains a huge challenge due to the high activation barrier for CO2 and poor selectivity. Herein, the highly dispersed triruthenium single cluster (Ru3-SCs) is confined into the nanospace of pyrrole-3-carboxylic acid (PyrA)-modified nickel-porphyrin-based metal-organic framework (Ni-PCN-222-PyrA) to form the composite (Ru3-SCs@Ni-PCN-222-PyrA) through the pre-coordination confinement strategy. The prepared Ru3-SCs@Ni-PCN-222-PyrA can accelerate the selective reduction of CO2 to CH4 via electrocatalysis. Under -1.0 V versus reversible hydrogen electrode (RHE), Ru3-SCs@Ni-PCN-222-PyrA affords CO2 electroreduction to CH4 with a high selectivity of 71.9% Faradaic efficiency. Mechanistic studies reveal that the superior reactivity can be attributed to the ensemble effect and synergistic catalysis of Ru3-SCs, in which one Ru atom is responsible for CO2 reduction to *CO and another Ru atom promotes the water splitting to generate *H, and then the two intermediates of *CO and *H coupled to form the key intermediate of *CHO in a thermodynamically favorable way.