In this work, nitrogen flows are estimated and analyzed in the different compartments of the Spanish agri-food system at three system scales (crops, livestock and agri-food system) and two spatial scales (province and country) for 26 years (1990-2015). Nitrogen use efficiency has improved in some crop and livestock systems. However, pollution by N compounds has barely decreased. The Spanish provinces have been classified into four typologies depending on the main source of N that activates the system. A reconnection between crops and livestock has great potential to improve the efficiency of nitrogen use at a system scale, making the country more resilient to rising fertilizer and feed prices.