Judicious tuning of electronic effects, chemical functionalities, and type and distribution of active sites is a promising strategy to manage the selectivity, efficiency, and electrochemical stability of electrocatalysts toward the electrochemical reduction of CO2 (ERCO2). Herein, we report a simple postsynthetic modification to tune electronic effects and Lewis basicity in copper-based three-dimensional (3D) and two-dimensional (2D) metal–organic frameworks (MOFs) involving the chemical transformation of the free −COOH/–OH groups into amide/amine groups that improves their electrocatalytic stability and performance for hydrocarbon production. Detailed structural and voltammetric characterizations reveal that the unique electronic and structure-enhancing effects in the modified MOFs (especially in 2D MOF) endow them with excellent electrocatalytic performance (overall faradaic efficiency (FE) 81%, with FEC1 = 62% and FEC2 = 19%) and stability toward ERCO2 (>4 h). The significantly high FE for the production of hydrocarbons over the modified MOFs is attributed to the improved Lewis acidity of the open metal centers and confined pores resulting in alternate active sites for *CO adsorption, hydrogenation, and C–O bond dissociation.