The Spec construction has the following property: there is a natural bijection $\textbf{LocRingSp}(X, \operatorname{Spec} A) \cong \textbf{CRing}(A, \mathscr{O}(X))$ Hence, there is always a morphism $X \to \operatorname{Spec} \mathscr{O}(X)$. Moreover, for any ring $B$ and any morphism $X \to \operatorname{Spec} B$, there is a unique factorisation through $\operatorname{Spec} \mathscr{O}(X)$. So you can think of $\operatorname{Spec} \mathscr{O}(X)$ as being the universal affine scheme which approximates $X$.
The case where $X$ is a connected complex projective manifold is somewhat uninteresting though: $\mathscr{O}(X)$ is just the ring of complex numbers $\mathbb{C}$, and $\operatorname{Spec} \mathscr{O}(X)$ is just a point. Perhaps you should be asking about relative Spec?