Queensland Labor has held on to the south Brisbane electorate of Stretton with voters choosing James Martin to succeed Labor's Duncan Pegg.
The popular local politician died of cancer just shy of his 41st birthday on June 10, ending his six-year parliamentary stint.
The Labor MP enjoyed a 14.8 per cent margin in the multicultural electorate covering Stretton, Calamvale, Eight Mile Plains, Kuraby, Sunnybank Hills and Underwood.
Mr Martin, Mr Pegg's former staffer, won comfortably, facing down a challenge from former police officer Jim Bellos for the Liberal National Party.
At 8.55pm on Saturday Mr Martin had won more than 56 per cent of votes counted while Mr Bellos had just under 33 per cent, the Electoral Commission Queensland website showed.
"I want to thank all the Stretton community for supporting me to be the next member for Stretton," Mr Martin said in a statement after Labor claimed the win.
"I will work everyday to continue the legacy of my friend Duncan Pegg who lost his battle to cancer too young."
Mr Martin said that as part of Annastacia Palaszczuk's Labor team in government he would deliver for Stretton, from road upgrades to investment in local schools.
"The hard work starts today."
In a statement Mr Bellos congratulated Mr Martin and said that while the result was not what he had hoped for the LNP had increased its vote in the seat.
"The cause of the by-election was tragic and James has large shoes to fill.
"We will be watching carefully to make sure that our area doesn't miss out on its fair share," Mr Bellos said.
The Greens nominated Andrea Wildin, Suzanne Clarke ran for the Animal Justice Party and Jasmine Melhop was on the ballot for Informed Medical Opinions.
More than 18,000 of the almost 34,000 constituents voted in person. Some 10,200 voted on election day, while 7800 chose to vote early.
The official election result may not be called by the Electoral Commission Queensland for some time, as Saturday's count is only a preliminary count.
Postal votes will only be returned by August 3.
The government campaigned on its pandemic response and securing the 2032 Brisbane Olympics.
The LNP was on the backfoot, with the government scheduled poll on the same day of the party's annual state convention.
LNP figures were frustrated many grassroots members were not able to man the booths for Mr Bellos.
The former Queenslander of Year pledged to ease local road congestion, deliver more hospital beds and improve school safety.
But Mr Bellos' campaign had a number of setbacks.
Last week he issued an apology for abusive social media posts about a female journalist four years ago, while soon after Mr Pegg died, his grieving family said photos of him were being "misused" in a brochure for Mr Bellos.
Labor's Stephen Robertson held Stretton from 2009 until 2012 and also its predecessor seat of Sunnybank from 1992 until 2009.
Australian Associated Press
Sign up for our newsletter to stay up to date.