Voting closed in Moldova at 21:00 (19:00 GMT), with turnout 54% higher than four years ago and particularly high among foreign voters at polling stations abroad.
In Moldova itself, Stojanoglu won with more than 51% of the vote, according to preliminary results, but Sandu was far ahead in the capital, Chisinau, and completely dominated among foreign voters.
As she overtook her rival, her campaign headquarters erupted in applause and chants of “victory.”
With a hoarse voice, she made a late-night statement in which she promised to be president for all Moldovans. She praised her compatriots for giving “a lesson in democracy worthy of being recorded in the history books.”
“Today you saved Moldova. No one lost in our election for a dignified future,” she added.
Its leadership was expected to become even more evident when the results were received from the US as well as the EU. The final result will be announced on Monday.
Casting his vote, he promised to be an “apolitical president” for everyone, telling reporters that he voted for “Moldova, which should develop in harmony with both the West and the East.”
Stojanoglu polled particularly well in rural areas and the south, while Sandu was ahead in cities and abroad, according to Moldovan media.