Electromigration has evolved from an important cause of failure in electronic devices to an appealing method, capable of modifying the material properties and geometry of nanodevices. Although this technique has been successfully used by researchers to investigate low dimensional systems and nanoscale objects, its low controllability remains a serious limitation. This is in part due to the inherent stochastic nature of the process, but also due to the inappropriate identification of the relevant control parameters. In this study, we identify a suitable process variable and propose a novel control algorithm that enhances the controllability and, at the same time, minimizes the intervention of an operator. As a consequence, the algorithm facilitates the application of electromigration to systems that require exceptional control of, for example, the width of a narrow junction. It is demonstrated that the electromigration rate can be stabilized on pre-set values, which eventually defines the final geometry of the electromigrated structures. Published by AIP Publishing. https://doi