Inherited from Old Spanish costar, from Latin cōnstāre; the o-ue alternation may have been influenced by the unrelated noun cuesta. Doublet of constar, a borrowing.
Practice speaking and memorizing "costar" and many other words and sentences in Spanish.