Sanford voting in Charleston, S.C. (AP Photo/Rainier Ehrhardt)

Mark Sanford won the South Carolina special election comfortably Tuesday, emerging victorious in a competitive race for what in normal circumstances is a safe Republican seat.

The former governor beat Democrat Elizabeth Colbert Busch, the sister of comedian Stephen Colbert Busch, for the state's 1st congressional district. 

In the end, Sanford won by nine points, 54 percent to 45 percent, according to the Associated Press's tally.

In remarks at a victory rally Tuesday night, Sanford tipped his cap to Colbert Busch and her team for a "well-run race." But the campaign, he said, "was based on two very different ideas on what ought to come next in Washington."

Sanford also sounded a spiritual note in his address, thanking "God's role in all of this," and calling himself an "imperfect man" who was "saved by God's grace."

Mitt Romney won this district by 18 points last fall, but Sanford's personal history made the seat competitive. Democrats poured money into the race while national Republicans abandoned their candidate, giving Colbert Busch a 5-to-1 advantage in outside spending.

Those ads, and Colbert Busch herself, made an issue out of Sanford's 2009 disappearance to be with his Argentinean mistress, which led to an ethics investigation into his travel.

In spite of that cash and a trespassing complaint filed by Sanford's ex-wife before the election, he was gaining momentum. Throughout the race he tied Colbert Busch to national Democrats and emphasized his own fiscal conservatism, an ultimately successful strategy.

“Congratulations to Mark Sanford for winning tonight’s special election," said National Republican Congressional Committee Chairman Greg Walden of Oregon. "These results demonstrate just how devastating the policies of Barack Obama and Nancy Pelosi are for House Democrats in 2014.

It's a surprising comeback for a politician whose career was considered dead. But there's a silver lining for Democrats -- now they can link House Republicans to Sanford, who is still someone with whom the national GOP would rather not be associated.

Sanford replaces former Rep. Tim Scott (R), who was appointed by Gov. Nikki Haley (R) to serve out the Senate term of Heritage Foundation President Jim DeMint.

"House Republicans’ outreach to women voters now has Mark Sanford as the face. Republicans now have to defend him and stand with him until Election Day," said Democratic Congressional Campaign Committee Chairman Steve Israel of New York.

-- Sean Sullivan contributed to this post. An earlier version of the post incorrectly did not capitalize the word "God" in Sanford's remarks.

Updated at 9:50 p.m.