Carvalho looked to have won with 50.1 percent of votes, with De Costa coming second with 24.8 percent.
A Sao Tome and Principe court ruled on Sunday that the island nation's presidential election will go to a second round between incumbent Manuel Pinto da Costa and ex-speaker of parliament Evaristo Carvalho.
In provisional results from elections held last Sunday, Carvalho looked to have won with 50.1 percent of votes, with De Costa coming second with 24.8 percent.
But the supreme court overturned them, saying the electoral commission should have waited for results from a town, Maria Louise, that voted on Wednesday, and for results from the diaspora. When factored in, they left Carvalho just shy of the 50 percent needed for an outright win, it said.
The run-off will take place on August 7.
The small island nation located in the Gulf of Guinea is a former colony of Portugal and has a semi-presidential system. The prime minister heads the government but the president is more than a figure head, wielding considerable executive power over matters such as security.
The country has 19 oil blocks in its exclusive economic zone and an additional joint exploration zone with Nigeria, but it is yet to find any commercially viable oil.