Core-periphery structure is a common property of complex networks, which is a composition of tightly connected groups of core vertices and sparsely connected periphery vertices. This structure frequently emerges in traffic systems, biology, and social networks via underlying spatial positioning of the vertices. While core-periphery structure is ubiquitous, there have been limited attempts at modeling network data with this structure. Here, we develop a generative, random network model with core-periphery structure that jointly accounts for topological and spatial information by "core scores" of vertices. Our model achieves substantially higher likelihood than existing generative models of core-periphery structure, and we demonstrate how the core scores can be used in downstream data mining tasks, such as predicting airline traffic and classifying fungal networks. We also develop nearly linear time algorithms for learning model parameters and network sampling by using a method akin to the fast multipole method, a technique traditional to computational physics, which allow us to scale to networks with millions of vertices with minor tradeoffs in accuracy.Networks are widely used to model the interacting components of complex systems emerging from biology, ecosystems, economics, and sociology [1][2][3]. A typical network consists of a set of vertices V and a set of edges E, where the vertices represent discrete objects (e.g., people or cities) and the edges represent pairwise connections (e.g., friendships or highways). Networks are often described in terms of local properties such as vertex degree or local clustering coefficients and global properties such as diameter or the number of connected components. At the same time, a number of mesoscale proprieties are consistently observed in real-world networks, which often reveal important structural information of the underlying complex systems; arguably the most well-known is community structure, and a tremendous amount of effort has been devoted to its explanation and algorithmic identification [4][5][6][7].