Brexit-backing new MP Caroline Johnson has comfortably won the Sleaford and North Hykeham by-election.
She held the seat for the Conservatives with 53.5% of the vote, seeing off the challenge from Ukip in an area that backed the Leave cause in the European Union referendum.
Labour had a bad result, slipping from second in 2015 to fourth behind the Liberal Democrats in the Lincolnshire seat.
The contest was triggered by the resignation of Tory MP Stephen Phillips over "irreconcilable policy differences" with the Government on issues like the handling of the process of quitting the EU.
Johnson used her acceptance speech to promise to bolster PM Theresa May's position in Parliament to make sure Brexit happens.
The Tory majority of 13,144 in Sleaford and North Hykeham was lower than that secured by Phillips last year but represents a comfortable hold for the Conservatives in a by-election with a turnout of just 37%.
The Tory share of the vote was down 2.7% on 2015, while Ukip's Victoria Ayling won 13.5% of the vote for her party, down 2.2%.
Ukip leader Paul Nuttall, who was at the count, said it was a "great result" for the party following the turmoil of recent months.
He said: "If someone would have offered me second place at the beginning of the campaign, considering we were in the middle of a leadership election and the party resembled a bit of a shambles over the summer, I would have bitten their hand off. I think it's a really good way to get my leadership off the ground. This is a small step on a long road."