Nitrogen fixation, a process that converts dinitrogen gas to biologically available nitrogen forms by diazotrophic plankton (nitrogen fixers), is thought to support roughly half of the ocean's new production in the subtropical North Pacific ocean. But this estimate, based on limited point measurements of in-situ fixation rates, has large uncertainties and is challenging to scale up to the global ocean. In-situ N-fixation rate measurements are highly variable. They span 6 orders of magnitude. As an alternative to in-situ measurements we present a global inverse model for the marine nitrogen cycle with which we infer large-scale patterns of N fixation. Unlike previous inverse estimates of N fixation, the model does not assume Redfield stoichiometry. Instead, the N:P ratio of exported organic matter is inferred as part of the inversion. The model predicts the highest N fixation rates are in the subtropical gyres and the lowest are in high nutrient upwelling regions regardless of the N:P ratio in those waters.