Knot theory can be generalized to virtual knot theory and spatial graph theory. In 2007, Fleming and Mellor combined and generalized them to virtual spatial graph theory in a combinatorial way and extended the Yamada polynomial from spatial graphs to virtual spatial graphs by ignoring virtual crossings. In this paper, we introduce a topological definition of the virtual spatial graph which is similar to that of a virtual link. Our main goal is to generalize the Yamada polynomial from spatial graphs to virtual spatial graphs such that it could capture the virtuality. It is realized via adding a new variable and integrating the topological Tutte polynomial instead of the Tutte polynomial into our polynomial. We define the generalized Yamada polynomial for virtual spatial graphs via their diagrams and prove that it can be normalized to be a rigid vertex isotopic invariant of virtual spatial graphs and to be a pliable vertex isotopic invariant for virtual spatial graphs with maximum degree at most 3. We consider the connection and difference between our generalized Yamada polynomial and the Dubrovnik polynomial of a classical link, and proved the generalized Yamada polynomial specializes to a version of the Dubrovnik polynomial for classical links which can be used to sometimes detect the virtuality of virtual links. We also prove the generalized Yamada polynomial specializes to the bracket polynomial of the associated diagram obtained from a virtual spatial graph diagram with the Jones–Wenzl projector P 2 acting on it, which can be used to write a program for calculating this special parametrization of the generalized Yamada polynomial based on Mathematica Code.