Understanding the dynamics of food trade, which involves a corresponding virtual trade in environmental resources, is relevant for its effects on the environment. Among the socioeconomic factors driving the international food market, trade agreements play a significant yet poorly understood role in facilitating access to worldwide trade. Focusing on the global trade of grain from 1993 to 2015, we investigate the role of trade agreements in activating new linkages and increasing traded volumes and their environmental implications. Through a data-driven approach, we show that the activation of a trade agreement among countries induces a more than six-fold increase in the probability of establishing a new link. Also, the presence of a trade agreement over time, not just its activation, relates to a more stable market since it reduces the probability of link deactivation by more than half. The trade links covered by agreements show larger flows and smoother inter-annual fluctuations. Furthermore, trade agreements encourage the development of more water-efficient flows by stimulating the exchange of crops with high water productivity values. The average economic water productivity of crops traded under trade agreements increases by 62% when considering total virtual water and even by 93% when focusing on blue water.