Tom Parker, former Alabama Chief Justice Roy Moore's former legal adviser, unseated Justice Jean Brown, who opposed Moore's position on the Ten Commandments.
With 99 percent of the precincts reporting, Parker had 107,160 votes, or 51 percent, compared to 103,123 votes, or 49 percent, for Brown.
Moore became a hero of the religious right over his advocacy of the posting of the Ten Commandments in public buildings. Last year, Moore refused to remove a 2 ½-ton granite monument of the Ten Commandments, which he had placed in the rotunda of the Alabama Judicial Building.
Complying with a federal court order, Brown and the other Supreme Court justices voted to overrule Moore and remove the monument.
Brown's decision ignited a hotly contested re-election battle against Parker.
In a television commercial, Brown said she was proud the Ten Commandments "are displayed in our courthouse," according to the New York Times. "It was the right thing to do, and we did it the right way."
One of Parker's commercials asked, "Who can Alabama conservatives trust?" Showing a picture of Brown, the commercial said, "She removed the Ten Commandments, and insulted us with her politically correct A.C.L.U-approved display."
The Decatur Daily reported that Brown raised and spent more than $1 million for her re-election bid, compared to Parker who raised $300,000 and spent at least $150,000.
Most of Brown's television and radio advertisements portrayed her as "a devoted Christian and steadfast conservative," said the Decatur Daily.
Right-wing Christian groups endorsed Parker, including the League of Christian Voters, which identified itself as committed to electing "bold Bible believers in 2004 elections" and "to call America back to its Judeo-Christian roots."
Another conservative organization, Southern Events, said Brown "voted to remove the Ten Commandments from the Judicial Building, has ruled in favor of homosexual adoption, and who supported the removal of Judge Moore."
The site said that Parker "is a committed Christian and a Constitutionalist."
Brown rejected the accusation that she was not devout. She told USA Today, "I reject the notion that this is the Christians vs. the non-Christians here or Christians vs. the business community because I have been a Baptist Sunday school teach for almost 20 years."
Brown, a member of First Baptist Church of Montgomery, said, "My faith is a very important part of my life."
The Anniston Star, Birmingham News, Decatur Daily, Huntsville Times and Mobil Register all endorsed Brown.
Moore told the Montgomery Advertiser last week that Brown "does not support me or what I stood for, and the deceptive ads that imply that she does are simply misleading and untrue."
"She knows that, and I know it, and I think the public should know that, too," he said.
Two other statewide candidates on the Moore slate were defeated. Pam Baschab lost to Patti M. Smith for a Supreme Court seat, while Phillip Jauregui lost to incumbent U. S. Representative Spencer Bachus.
In a third race for a Supreme Court seat, Mike Bolin won 50 percent of the vote, holding a sizable lead over Jerry Stokes, the pro-Moore candidate, who received 26 percent of the vote in a four-way race. To avoid a runoff, Bolin needed to receive more than half the vote.