Shot US lawmaker Gabrielle Giffords's former aide Ron Barber will succeed her in Congress after a vote that denied Republicans an upset ahead of November ballots.

Results from all precincts showed Barber, like Giffords a Democrat, defeating Republican Jesse Kelly by 52-45 percent in Tuesday's vote, triggered by Giffords's decision to step down after last year's deadly shooting rampage.

Top congressional Democrat Nancy Pelosi hailed the result as a "well-deserved victory."

"Congressman-elect Barber follows in the footsteps of our extraordinary colleague, Congresswoman Gabby Giffords -- and he has enormous shoes to fill," she said.

"Gabby left a legacy of strength, resolve, and independence in the House," she added in a statement cited by the Arizona Central website. "We look forward to Ron Barber continuing in that same tradition."

A recent poll had put Barber -- who was wounded in the January 2011 shooting that nearly killed Giffords -- 12 points ahead of the Republican challenger, but the lead narrowed ahead of the vote.

Giffords stepped down in January to focus on her rehabilitation after being shot in the head in an attack that left six people dead, including a US federal judge and a member of the congresswoman's staff.

She campaigned with Barber over the weekend with her husband Mark Kelly, a retired NASA astronaut, who told supporters in Tucson, Arizona that Tuesday's special election would be packed with emotion.

The victory in Arizona's politically moderate 8th District means the Democrats keep a seat seen as crucial to their long-shot bid to take back Congress in 2012.

While Giffords vocally backed her hand-picked successor, Republicans had sought to make the race a referendum on President Barack Obama's handling of the economy ahead of November's White House and congressional elections.

It was watched closely for clues to the broader electoral map, as the seat is seen as important for Democratic efforts to regain control of the House of Representatives, which they lost to Republicans in 2010.

Barber will serve out the remaining months of Giffords's term and will have a leg up in the November election, which both he and Kelly have said they will contest in a rematch.

The district leans Republican, but Barber clearly benefited from widespread goodwill towards Giffords, who has made what has been described as a miraculous recovery after being shot through the head.

The tragedy united Americans -- and long-bickering US lawmakers -- in grief.

The 42-year-old Giffords, a onetime rising star in the Democratic Party, continues to speak haltingly and walks with difficulty.

Until Monday the race was a nail-biter, with internal polling in both camps showing the campaign going down to the wire.

A Kelly victory would have come as a shock to Democrats and been taken as a sign that voters feel Obama's policies have not done enough to turn around a struggling national economy and reduce the high unemployment rate.

Tuesday's vote was a chance at political redemption for Kelly, who lost to Giffords in 2010 by just 4,000 votes.

That bruising campaign was occasionally off-color, such as when Kelly invited supporters to shoot a loaded M-16 assault rifle with him.

The candidates ran a more civil, issues-oriented race this year.

But that did not stop outside groups -- which have poured vast amounts of money into the race -- and party committees from going negative with a series of attack ads on both sides.