Magneto- and electroencephalography (M/EEG) are widespread techniques to measure neural activityin-vivoat a high temporal resolution but low spatial resolution. Locating the neural sources underlying the M/EEG poses an inverse problem, which is ill-posed. We developed a new method based on Recursive Application of Multiple Signal Classification (MUSIC). Our proposed method is able to recover not only the locations but, in contrast to other inverse solutions, also the extent of active brain regions flexibly (FLEX-MUSIC). This is achieved by allowing it to search not only for single dipoles but also dipole clusters of increasing extent to find the best fit during each recursion. FLEX-MUSIC achieved the highest accuracy for both single dipole and extended sources compared to all other methods tested. Remarkably, FLEX-MUSIC was capable to accurately estimate the level of sparsity in the source space (r= 0.82), whereas all other approaches tested failed to do so (r≤ 0.18). The average computation time of FLEX-MUSIC was considerably lower compared to a popular Bayesian approach and comparable to that of another recursive MUSIC approach and eLORETA. FLEX-MUSIC produces only few errors and was capable to reliably estimate the extent of sources. The accuracy and low computation time of FLEX-MUSIC renders it an improved technique to solve M/EEG inverse problems both in neuroscience research and potentially in pre-surgery diagnostic in epilepsy.