Updated

Democrats avoided a second election loss in as many weeks Tuesday as Democrat Ron Barber defeated Republican Jesse Kelly in an Arizona special election for the House seat previously held by former Rep. Gabrielle Giffords.

Giffords resigned a year after she was shot in the head while meeting with constituents at a Tucson shopping center.

Barber, a former aide to Giffords, defeated Republican Jesse Kelly, a former Marine who narrowly lost a House race to Giffords in 2010.

The 66-year-old Barber was seriously injured in the same rampage in which Giffords was shot. Six others were killed.

Both the GOP and the Democrats were using the race to hone and test their political arguments for the November elections, when everything from the White House on down will be on the ballot.

Republicans, sensing a chance to capture the former congresswoman's seat in southern Arizona, sought to make the contest a referendum on President Barack Obama and his handling of the economy. They argued that Democrat Ron Barber, a former Giffords aide asked by the lawmaker to pursue the seat, would fall in line behind the White House.

Democrats, in turn, played to the senior vote by contending that Republican Jesse Kelly, who narrowly lost to Giffords in 2010, would not protect Medicare and Social Security.

Barber will complete the remainder of Giffords' term. Both candidates are promising to run for a full term in the fall, setting up a possible November rematch in a redrawn district that is friendlier to Democrats.

The Associated Press contributed to this report.