Britain’s opposition Labour Party won back a parliamentary seat in Scotland on Friday by a thumping margin, after a closely watched race that had been viewed as a barometer of the party’s national appeal before a general election next year.
In a dramatic swing of votes, Labour unseated the Scottish National Party from the Rutherglen and Hamilton West district, a cluster of towns outside Glasgow that had been held by the S.N.P. since 2019. Voters triggered the by-election by recalling the party’s representative, Margaret Ferrier, after she violated lockdown restrictions during the coronavirus pandemic.
The result was striking evidence of a Labour revival in Scotland. But the broader significance is for the party’s looming national contest with the governing Conservative Party. Analysts said the victory suggested that Labour could make significant inroads against the S.N.P. across Scotland next year, which could give it the margin to amass a clear majority in Parliament over the Tories.
Though a Labour victory was expected, its scale was not. The wide margin gives a welcome shot of momentum to the Labour leader, Keir Starmer, two days before his party gathers in Liverpool for its annual conference. It will add to the sense that Labour, with a nearly 20-point advantage over the Conservatives in national polls, is a government in waiting.
It also dramatizes the collapsing fortunes of the Scottish nationalists, for many years a hugely powerful force in Scottish politics, led by the charismatic Nicola Sturgeon. Her sudden resignation in February plunged the party into division, and within months it was hit by a financial scandal that undermined voter confidence.
Labour had been left with only a single seat in Scotland after its bruising defeat in the 2019 general election, while the surging S.N.P. picked up 48 seats. Even before Thursday’s vote, polls had suggested that Labour could grab back as many as half of those seats in the next election, which would give it a valuable cushion, even if its lead over the Conservatives narrows nationally.
When all the votes were tallied early on Friday morning, the district elected the Labour candidate, Michael Shanks, over the S.N.P. candidate, Katy Loudon, by a margin of 9,446. The seat had traded hands between the parties several times since it was created in 2005; Ms. Ferrier had held a margin of only 5,230 people.
Labour won 58.6 percent of the vote, an increase of 24.1 percentage points over its last election, while the S.N.P. drew 27.6 percent, a decline of 16.6 percentage points. The Conservatives won only 3.9 percent, a decline of 11.1 points, while 11 other candidates split the remainder of the vote.
Speaking to cheering supporters, Mr. Shanks said the results sent an unmistakable message that “it’s time for change,” adding, “There’s not a part of this country where Labour can’t win.”
Anas Sarwar, the leader of the Scottish Labour Party, characterized it as a “seismic” victory in an interview with the BBC. “Scottish politics has fundamentally changed,” he said.
If Labour were to perform as well in every constituency in Scotland as it did in Rutherglen, it could win more than 40 seats in a general election and re-establish itself as the dominant party in Scotland, John Curtice, a professor at the University of Strathclyde and a leading pollster, told the BBC.
“This is a remarkably good result for the Labour Party,” he said.
Turnout for by-elections is typically lower than in general elections, but the 37 percent turnout in this vote was a particularly steep decline from 2019. Analysts attributed that to a combination of heavy rain and a requirement for voter ID — a first in a Scottish election — which officials said may have resulted in some people being turned away from polling places.
But the low turnout did not hamper Labour, which had poured resources into the race. Mr. Starmer and other Labour leaders campaigned aggressively in the district, emphasizing Mr. Shanks’s roots in the community, where he is a schoolteacher.
The result is a stinging setback for Humza Yousaf, who replaced Ms. Sturgeon as S.N.P. leader and first minister of Scotland, and who campaigned energetically on behalf of Ms. Loudon, a former schoolteacher and respected local council member.
For all the euphoria among Labour officials, some observers said the result was as much a reflection of disgust with Ms. Ferrier’s behavior, and fatigue with the S.N.P. more broadly amid an ongoing cost of living crisis, as it was of excitement about Mr. Shanks and Labour.
“The S.N.P. has brought Scotland to its knees,” Elizabeth Clark, 68, a retired nurse in Rutherglen, said last month.
Still, as polls closed at 10 p.m. on Thursday night, Jackie Baillie, the deputy leader of the Scottish Labour Party, was confident. “It is clear for all to see,” she said, “that Scottish Labour is once more a serious force in Scottish politics.”