We study spontaneous scalarization of electrically charged extremal black holes in D ≥ 4 spacetime dimensions. Such a phenomenon is caused by the symmetry breaking due to quartic interactions of the scalar — Higgs potential and Stueckelberg interaction with electromagnetic and gravitational fields, characterized by the couplings a and b, respectively. We use the entropy representation of the states in the vicinity of the horizon, apply the inverse attractor mechanism for the scalar field, and analyze analytically the thermodynamic stability of the system using the laws of thermodynamics. As a result, we obtain that the scalar field condensates on the horizon only in spacetimes which are asymptotically non-flat, Λ ≠ 0 (dS or AdS), and whose extremal black holes have non-planar horizons k = ±1, provided that the mass m of the scalar field belongs to a mass interval (area code) different for each set of the boundary conditions specified by (Λ, k). A process of scalarization describes a second order phase transition of the black hole, from the extremal Reissner-Nordström (A)dS one, to the corresponding extremal hairy one. Furthermore, for the transition to happen, the interaction has to be strong enough, and all physical quantities on the horizon depend at most on the effective Higgs-Stueckelberg interaction am2− 2b. Most of our results are general, valid for any parameter and any spacetime dimension.