We describe a new framework and method for the optimal selection of anatomical landmarks and optimal placement of fiducial markers in image-guided neurosurgery. The method allows the surgeon to optimally plan the markers locations on routine diagnostic images before preoperative imaging and to intraoperatively select the fiducial markers and the anatomical landmarks that minimize the Target Registration Error (TRE). The optimal fiducial marker configuration selection is performed by the surgeon on the diagnostic image following the target selection based on a visual Estimated TRE (E-TRE) map. The E-TRE map is automatically updated when the surgeon interactively adds and deletes candidate markers and targets. The method takes the guesswork out of the registration process, provides a reliable localization uncertainty error for navigation, and can reduce the localization error without additional imaging and hardware. Our clinical experiments on five patients who underwent brain surgery with a navigation system show that optimizing one marker location and the anatomical landmarks configuration reduces the average TRE from 4.7mm to 3.2mm, with a maximum improvement of 4mm. The reduction of the target registration error has thepotential to support safer and more accurate minimally invasive neurosurgical procedures.