In this paper, we apply a newly developed method to solve boundary value problems for differential equations to solve optimal space guidance problems in a fast and accurate fashion. The method relies on the least-squares solution of differential equations via orthogonal polynomial expansion and constrained expression as derived via Theory of Connection (ToC). The application of the optimal control theory to derive the first order necessary conditions for optimality, yields a Two-Point Boundary Value Problem (TPBVP) that must be solved to find state and costate. Combining orthogonal polynomial expansion and ToC, we solve the TPBVP for a class of optimal guidance problems including energy-optimal constrained landing on planetary bodies and fixed-time optimal intercept for a target-interceptor scenario. An analysis of the performance in terms of accuracy and computational time is provided to evaluate the performance of the proposed algorithm for realtime implementation.