Media playback is unsupported on your device Media caption Labour's Emma Lewell-Buck: "I am absolutely ecstatic"

Labour has won the South Shields parliamentary by-election, retaining a seat it has held since 1935.

It saw its majority reduced in Thursday's poll as the UK Independence Party finished a clear second, with a 24% share of the total vote.

The Conservatives were pushed into third while their Liberal Democrat coalition partners finished seventh.

Labour candidate Emma Lewell-Buck said she was "absolutely ecstatic" about her by-election victory.

The South Shields contest was triggered by the resignation of former Labour Foreign Secretary David Miliband as an MP.

UKIP also made significant gains in county council elections in England.

'Here to stay'

Ms Lewell-Buck argued that the result showed Labour was connecting with voters and the coalition government was taking the country in the "wrong direction".

As the result was announced, she said: "Mr Cameron, when working families needed a government on their side, you made them pay for a tax cut for millionaires.

"When our young people needed jobs, you gave them a shrinking economy, and when the most vulnerable people in our society were really struggling you gave them the bedroom tax."

Ms Lewell-Buck added: "I will help get people back to work, champion our wonderful town and never give the Tory government one moment's peace."

However, her majority of 6,505 - on a turnout of 39.2% - was significantly down on the 11,109 achieved by Mr Miliband three years ago.

SOUTH SHIELDS RESULT Emma Lewell-Buck (Labour) 12,493 votes

Richard Elvin (UK Independence Party) 5,988 votes

Karen Allen (Conservatives) 2,857 votes

Ahmed Khan (Independent) 1,331 votes

Phil Brown (Independent Socialist Party) 750 votes

Lady Dorothy Macbeth Brookes (BNP) 711 votes

Hugh Annand (Liberal Democrats) 352 votes

Howling Laud Hope (The Official Monster Raving Loony Party) 197 votes

Thomas Faithful Darwood (Independent) 57 votes

UKIP candidate Richard Elvin came second with 5,988 votes.

The party, which did not even stand in the constituency in the last general election, won 24% of the vote, marginally lower than its record 28% vote share in March's by-election in Eastleigh, Hampshire, when it also came second.

UKIP's deputy leader Paul Nuttall said the performance, which came on the heels of strong showings in other by-elections in the north of England last year, proved it was on "an upward trajectory" and the party's appeal spread across the country.

"UKIP is here and it is here to stay," he told the BBC.

The parties in government will comfort themselves that it's mid-term - people wanted to give them a bloody nose Louise Stewart, Political correspondent, BBC News Analysis: Bloody nose for coalition

And he claimed it would not be long before his party had its first MP elected.

"We have been knocking on the door of Westminster for the past two years. I predict very soon that we will kick that door in," he said.

'Disappointing'

The Conservatives came third with 2,857 votes, 5,000 fewer than they received in 2010 and it was an even more miserable night for the Lib Dems, who were beaten into seventh, getting fewer votes than the BNP and two independent candidates.

The party lost its deposit, having secured less than 5% of the total votes cast.

Its candidate Hugh Annand said the result was "extremely disappointing but perhaps not surprising" given that the Lib Dems were in government and having to take tough decisions.

He told the BBC that some supporters had not adjusted to the degree of compromise required in coalition and those wishing to register a protest vote had gone elsewhere.

Media playback is unsupported on your device Media caption UKIP deputy leader Paul Nuttall said his party is "going places"

"We have disappointed and angered some people who have supported us in the past," he said.

Former Lib Dem MP Lembit Opik, a frequent critic of party leader Nick Clegg, described the result as "appalling" and said party members "deserve to know how this electoral crisis will be fixed".

But the party's deputy leader Simon Hughes said: "Let me congratulate the Labour winner in South Shields, the first woman MP for South Shields, which is progress.

"This has been a Labour seat since it was created, certainly for years and years and years, and it's not a place where we had presence."

In the county council elections which coincided with the by-election, Conservative and Lib Dem vote share was significantly down, with UKIP and Labour the chief beneficiaries.

South Shields by-election result in full:

Emma Lewell-Buck (Labour): 12,493 (50.51%, -1.51%)

Richard Elvin (UK Independence Party): 5,988 (24.21%)

Karen Allen (Conservative): 2,857 (11.55%, -10.04%)

Ahmed Khan (Independent): 1,331 (5.38%)

Phil Brown (Independent Socialist): 750 (3.03%)

Lady Dorothy MacBeth Brookes (BNP): 711 (2.87%, -3.65%)

Hugh Annand (Liberal Democrat): 352 (1.42%, -12.79%)

Howling Laud Hope (The Official Monster Raving Loony Party): 197 (0.80%)

Thomas Darwood (Independent): 57 (0.23%)

Labour majority: 6,505 (26.30%), down from 11,109 (30.42%) in 2010

Electorate 62,979; Turnout 24,736 (39.28%, -18.42%), down from 36,518 (57.70%) in 2010