We introduce a novel concept for the design of functional surfaces of materials: Spatial surface charge engineering. We exploit the concept for an all-solid-state, epitaxial InN/InGaN-on-Si reference electrode to replace the inconvenient liquid-filled reference electrodes, such as Ag/AgCl. Reference electrodes are universal components of electrochemical sensors, ubiquitous in electrochemistry to set a constant potential. For subtle interrelation of structure design, surface morphology and the unique surface charge properties of InGaN, the reference electrode has less than 10 mV/decade sensitivity over a wide concentration range, evaluated for KCl aqueous solutions and less than 2 mV/hour long-time drift over 12 hours. Key is a nanoscale charge balanced surface for the right InGaN composition, InN amount and InGaN surface morphology, depending on growth conditions and layer thickness, which is underpinned by the surface potential measured by Kelvin probe force microscopy. When paired with the InN/InGaN quantum dot sensing electrode with super-Nernstian sensitivity, where only structure design and surface morphology are changed, this completes an all-InGaN-based electrochemical sensor with unprecedented performance.