Johann Lamont hailed the win in Dunfermline as a sign that fortunes are turning in Labour's favour.
"It's a very positive step. It's a very substantial result, an emphatic result. And given where we were in 2011, this is a very important stage," she said during a visit to the town today.
"That's where we've got back to, being in a process where we are able to compete politically."
Winning candidate Cara Hilton took the seat in west Fife with a 2,873 majority over the SNP which gained the seat from the Liberal Democrats in 2011.
Dunfermline is now the second safest Labour seat at Holyrood, behind Elaine Murray's 3,156 majority in Dumfriesshire.
Comparing that victory with the tough election two years ago, Ms Lamont told supporters: "I don't know whether to be chuffed about that or slightly anxious."
She also warned against complacency, despite a string of by-election victories in local council elections over the last year.
SNP leader Alex Salmond earlier suggested that if the 7% swing to Labour in Dunfermline is replicated nationally, his party would still be the largest.
Ms Lamont said: "Because the defeat in 2011 was so significant, then we know the scale of the challenge. What this does, however, is it confirms that both politically and organisationally we are able to compete and we can build on this."
The by-election was triggered by the resignation of shamed politician Bill Walker, jailed last month for abusing his three ex-wives.
He won the seat for the SNP with a 590 majority over runner-up Labour but was kicked out of the party when the allegations surfaced.
Walker clung on to the constituency as an Independent, even after being convicted. He eventually resigned amid public outrage and is now in jail.
His actions meant the SNP was forced to defend the constituency midway through its second term in government.
The result of the by-election, which had a turnout of 42.75%, was declared shortly before 2am.
Ms Hilton, elected with 10,275 votes, said Labour is reconnecting with voters and that independence was a turn-off for the electorate.
"The people of Dunfermline have rejected Scotland being put on pause for another year. The Government of Scotland has been suspended so that a referendum campaign can be won," she said.
"We need a Scottish Government that will address the needs of Scots, not one that will simply make promises about what will happen after 2016. Today Dunfermline has sent a message to Bute House and Alex Salmond: it's time for you to focus on the real priorities of Scots, not your constitutional obsession.
"Use the powers you have now to make a difference, not just argue for more in the future."
She also praised the action of Walker's ex-wives, which triggered the electoral contest.
"We are only here tonight because of the bravery of three women. Three women who came forward to demand justice and who won that fight. Their courage and determination must be a reminder to all of us that we need to work harder to ensure that all victims of domestic violence are able to come forward and receive the justice they deserve," she said.
She celebrated her victory inside Dunfermline Business Centre today with Ms Lamont and other senior Labour politicians and activists.
SNP candidate Shirley-Anne Somerville, who attracted 7,402 votes, said her party can be proud of its campaign which focused on the threat of school closures in the area.
"This has been a long and interesting campaign for all of us," she said. "It is one that the Scottish National Party can be particularly proud of. We've run a positive campaign trying to support local parents in their schools and I hope we can come together, all of us in the party, to make sure those three schools in the Dunfermline constituency stay open."
She was supported by First Minister Mr Salmond, who took to the streets of the Fife town in a last push for votes last night.
Liberal Democrats have been successful in the past at Westminster and Holyrood levels but would have needed to persuade a huge number of people to back them this time around.
Candidate Susan Leslie, who picked up 2,852 votes, drew attention to the number of women standing in the contest.
"I think it has been a victory for women in politics in Scotland that four women stood in this by-election and fought positive campaigns on the issues for Dunfermline," she said.
Scottish Conservative candidate James Reekie said: "When the people of Dunfermline are faced with the dilemma of Labour and the SNP, they choose the Conservatives."
He received 2,009 votes, one percentage point up on the last election.
The by-election was also contested by Zara Kitson for the Scottish Green Party (593 votes), Peter Adams for the UK Independence Party (908) and Independent candidate John Black (161), all three of whom lost their deposits.
The results show a swing from SNP to Labour of nearly 7%.