Sanford regained the First Congressional District seat he held from 1995 to 2001 before serving two terms as governor, the second of which was marred when he tried to hide an affair by falsely saying that he was hiking the Appalachian Trail.
He earned 54 percent of the vote to 45 percent for Colbert Busch, a businesswoman and first-time candidate whose brother is television satirist Stephen Colbert.
"I just want to acknowledge a God not just of second chances, but third, fourth, fifth, sixth, seventh, eighth chances," Sanford told cheering supporters in Mount Pleasant.
"I am one imperfect man saved by God's grace, but one who has a conviction on the importance of doing something about the spending in Washington, D.C.," he said.
The election, which garnered broad attention thanks to the colorful candidates, was held to fill the seat vacated by Republican Tim Scott when he was appointed to the U.S. Senate by Governor Nikki Haley in December.
Sanford, 52, had trailed Colbert Busch, 58, by 9 points two weeks ago in a poll taken soon after revelations that his ex-wife had accused him of trespassing at her home. He said he went there to watch the football Super Bowl with one of their four sons, but the allegations prompted the National Republican Congressional Committee to drop its financial support of Sanford's campaign.
Sanford was also the subject of attack ads that accused him of deserting the state in 2009 when the then-married governor made a secret visit to see his mistress in Argentina.
He paid more than $70,000 in fines for ethics violations that included using public money for personal travel. He was subsequently divorced and is now engaged to the other woman, Maria Belen Chapur, who attended his victory party.
Sanford gained momentum in the final weeks of the race as he shifted some of the focus off his personal lapses by depicting his opponent as a liberal in lock-step with national Democrats who are unpopular in the Republican-leaning district.
The district, which includes the city of Charleston and parts of four rural counties and stretches south along the coast to wealthy Hilton Head Island, has not been represented by a Democrat since the early 1980s.
"He ran a good campaign, but I think it's a story of district characteristics. Just in November, (presidential candidate Mitt) Romney won by 18 points," said Gibbs Knotts, a political scientist at the College of Charleston.
"Sex scandals hurt, but they don't shut you out," Knotts said. "The American public has been shown to be very forgiving."
Sanford said he planned to run for re-election in 2014, and analysts said the odds would be in his favor to win again.
Analysts said that Democrats missed their best shot at capturing the seat. Though Colbert Busch, was a political newcomer, she was seen as a legitimate contender thanks to her business background and Sanford's vulnerability.
"It's going to be a long, long time before (Democrats are) really able to be competitive" in the district, said Robert Oldendick, a political scientist at the University of South Carolina.