The bilateral trade relations between world countries form a complex network, the International Trade Network (ITN), which is involved in an increasing number of worldwide economic processes, including globalization, integration, industrial production, and the propagation of shocks and instabilities. Characterizing the ITN via a simple yet accurate model is an open problem. The classical Gravity Model of trade successfully reproduces the volume of trade between two connected countries using known macroeconomic properties such as GDP and geographic distance. However, it generates a network with an unrealistically homogeneous topology, thus failing to reproduce the highly heterogeneous structure of the real ITN. On the other hand, network models successfully reproduce the complex topology of the ITN, but provide no information about trade volumes. Therefore macroeconomic and network models of trade suffer from complementary limitations but are still largely incompatible. Here, we make an important step forward in reconciling the two approaches, via the introduction of what we denote as the Enhanced Gravity Model (EGM) of trade. The EGM combines the maximum-entropy nature of network models with the established econometric structure of the Gravity Model. Using a single, unified and principled mechanism that is transparent enough to be generalized to other economic networks, the EGM allows trade probabilities and trade volumes to be separately controlled via any combination of dyadic and country-specific macroeconomic variables. We show that the EGM successfully reproduces both the topology and the weights of the ITN, finally reconciling the conflicting approaches. Moreover, it provides a general and simple theoretical explanation for the failure of economic models that do not explicitly focus on network topology: namely, their lack of topological invariance under a change of units.