Robert Fico, who pledged during the campaign to end Slovakia's military aid to Kyiv, said he would do everything possible to open peace talks between Russia and Ukraine.
Mr Fico's left-wing populist Smer party topped the poll with 23 per cent of the vote, defying an initial exit poll that projected a win for the pro-western Progressive Slovakia.
The result sets the stage for coalition talks in which Mr Fico – who served two previous terms as prime minister from 2006 to 2010 and 2012 to 2018 – is expected to be given the first chance to form a government.
His victory was celebrated by Hungary's nationalist Prime Minister Viktor Orban, who has been the EU's most prominent dissenting voice on Ukraine.
Mr Orban congratulated Mr Fico on his "undisputable victory" in Slovakia and said it was "always good to work together with a patriot". Both countries border Ukraine and are members of Nato and the EU.
The beaten Progressive Slovakia, which took 18 per cent of the vote, said it would still try to form a coalition from the runner-up spot. But third-placed kingmaker HLAS has said it leans closer to Mr Fico's party on policy.
Mr Fico, 59, is seeking a return to power after resigning in 2018 when the murder of an investigative journalist sparked mass protests against corruption.
He campaigned on boosting social spending and challenging EU policy on issues including migration, climate change and security. He said Slovakia would not send Ukraine a "single round of ammunition".
"Slovakia and the people in Slovakia have bigger problems than Ukraine," he told a press conference on Sunday. He called for peace talks because "further killing will not help anyone".
Mr Fico has preciously echoed Kremlin talking points on the war by speaking of Russian citizens being attacked by "Nazis and fascists" and blaming Ukrainian forces for starting the conflict.
A return to power for Mr Fico could make it harder for the EU, which requires the consent of all 27 members to make key foreign policy decisions such as sanctions on Russia, to hold to a united line.
EU leaders have had to water down previous sanctions packages to get Mr Orban on board. Hungary is unusual among the bloc's members in opposing weapons aid to Ukraine.
Slovakia, which has been led by a caretaker government since former prime minister Eduard Heger was forced out by government infighting, has provided Ukraine with Soviet-era fighter jets and other equipment.
Ukraine has made gradual progress in a counter-offensive equipped with western tanks but there have been signs of fatigue among Kyiv's allies. Poland's nationalist government, which is up for re-election this month, has stopped arms deliveries amid a dispute with Ukraine over grain sales.
Diplomats are meanwhile grappling with the possibility that Donald Trump, who has questioned US aid to Ukraine and expressed Russia-friendly sentiments, could win back the White House in 2024.
President Joe Biden's Democrats accepted a spending deal with Republicans on Saturday that removed new assistance for Ukraine in exchange for averting a government shutdown. Any further aid will have to be negotiated separately.