The effective use of limited resources for controlling spreading processes on networks is of prime significance in diverse contexts, ranging from the identification of "influential spreaders" for maximizing information dissemination and targeted interventions in regulatory networks, to the development of mitigation policies for infectious diseases and financial contagion in economic systems. Solutions for these optimization tasks that are based purely on topological arguments are not fully satisfactory; in realistic settings the problem is often characterized by heterogeneous interactions and requires interventions over a finite time window via a restricted set of controllable nodes. The optimal distribution of available resources hence results from an interplay between network topology and spreading dynamics. We show how these problems can be addressed as particular instances of a universal analytical framework based on a scalable dynamic message-passing approach and demonstrate the efficacy of the method on a variety of real-world examples.Spreading corresponds to omnipresent processes describing a vast number of phenomena in social, natural and technological networks [1][2][3][4] whereby information, viruses and failures propagate through their edges via the interactions between individual constituents. Spreading cascades have a huge impact on the modern world, be it negative or positive. An 11 minute power grid disturbance in Arizona and California in 2011 led to cascading outages and left 2.7 million customers without power [5]. As many as 579,000 people around the world could have been killed by the H1N1 influenza pandemic characterized by a rapid spreading through the global transportation networks [6]. The U.S. economy losses from the 2008 financial crisis resulted from cascading bankruptcies of major financial institutions are estimated at the level of $22 trillion [7]. Therefore, it is not surprising that efficient prediction and control of these undesired spreading processes are regarded as fundamental questions of paramount importance in developing policies for optimal placement of cascade-preventing devices in power grid, real-time distribution of vaccines and antidotes to mitigate epidemic spread, regulatory measures in interbanking lending networks and other modern world problems, such as protection of critical infrastructures against cyber-attacks and computer viruses [8].On the other hand, spreading processes can also be considered beneficial. The ice bucket challenge campaign in social networks raised $115 million donations to the ALS association fighting the Amyotrophic Lateral Sclerosis, in particular due to a significant involvement of celebrities acting as "influencers" [9]. In the context of political campaigning, there are already winners [10,11] and losers, and this division is likely to become more pronounced and critical in the future [12]. Winners are those who use communication and social networks effectively to set the opinions of voters or consumers, maximizing the impact of scarce...