His focused effort to target a group that had heavily favored Republicans paid off, an exit poll shows.

As he vaulted into national acclaim with his 2004 Democratic convention speech, Barack Obama directly took on the assumption that his party should cede religious voters to the Republicans.

“We worship an awesome God in the blue states,” he said, pointedly adopting words from a song familiar to churchgoers, particularly younger ones.

The four-year effort by Obama, who is Christian, to narrow the gap between Democratic and Republican support among religious voters paid off last week when he won the race for the White House.

Exit polls showed the dramatic effect: Obama won 43% of voters who said they attend church weekly, eight percentage points higher than 2004 Democratic nominee John F. Kerry. Among occasional worshipers, Obama won 57%, 11 percentage points higher than Kerry, according to the National Election Pool exit survey.

When looking at how members of different faiths voted, the movement among Catholics is striking. They sided 52% to 47% with President Bush in 2004. But this year, they went 54% to 45% for Obama. That means Obama had more support among Catholics than did Kerry, himself a Catholic, by seven percentage points.

“Obama did better than Kerry among pretty much every religious group,” said Greg Smith, a research fellow at the Pew Forum on Religion & Public Life who analyzed the poll results.

Even among voters who describe themselves as born-again Christians or evangelicals, a group that tends to vote Republican, Obama improved on Kerry’s standing — although he came in a distant second to GOP nominee John McCain. Kerry had won 21% of evangelical voters; Obama won 26%.

The shift by religious voters may have resulted partly from changes in the electorate — voter participation by blacks and Latinos grew, and both groups tend to be regular churchgoers. Yet there is no doubt that secular voters were more supportive of Obama than religious ones, according to the exit poll.

The Obama campaign, however, made sure to court religious voters and took advantage of his connections to influential Christian leaders.

Nearly two years ago, when voters knew little about him, the Illinois senator stood alongside nationally known author and Pastor Rick Warren at Saddleback Church in Lake Forest for a televised AIDS conference. Earlier, Obama had asked Warren to review a chapter of his book “The Audacity of Hope.”

Obama again gained the attention of Christian voters in July when he pledged to expand a controversial White House program to give federal grants to churches and small community groups. The proposal, which would build on efforts by the Bush administration to direct government money to church groups, was announced in Zanesville, Ohio, a hotly contested state that Obama won on election day.

And at the Democratic National Convention in August, which held its first-ever interfaith prayer gathering, the party platform endorsed by Obama — while not backing away from its support for abortion rights — emphatically reached out to women with children who rely on programs meant to ease their struggle.

Obama’s ease in talking about his religion also helped him win over religious voters. During a presidential forum held in August at Saddleback Church, where he and McCain were interviewed separately by church leader Warren, Obama spoke about “walking humbly with our God” and quoted from the Gospel of Matthew. His acceptance speech Tuesday night echoed in parts the church-inspired speeches of the Rev. Martin Luther King Jr.

“He uses the faith language very well,” said Clyde Wilcox, a Georgetown University professor of government who has studied the subject. And that, he said, inspired trust.

“How do you know whether to trust him or not?” Wilcox said. “If you are a deeply religious person, you want to see that he has a grounding. That authenticity is really important. It reassures people.”

Religion, for a time, became a thorn for Obama during the presidential race. He was harshly criticized for his association with the now-retired Rev. Jeremiah A. Wright Jr., whose incendiary sermons about white America caused an uproar and led Obama to part ways with his longtime pastor, and endured a viral e-mail campaign falsely asserting that he is Muslim.

But “there was a broad recognition that he was a sincerely religious man,” Wilcox said of Obama. “And I think that did come through.”

The Obama campaign reached out to evangelicals and other religious communities, aware of the opportunity to peel away some voters.

Douglas W. Kmiec, a Pepperdine law professor, caused a stir last spring when he publicly endorsed Obama. One month later, at a Catholic Mass to which he was invited, Kmiec was denounced from the pulpit and denied communion because of his endorsement.

Kmiec said that although Obama’s support for abortion rights contradicts official Catholic doctrine, his broader approach aligns well with the church’s beliefs on issues such as the economy, healthcare and the environment.

“I was attracted out of my Republican-ness to Sen. Obama’s side largely because I could hear, in the way he was articulating economic issues and social issues, the social gospel of the Catholic Church,” Kmiec said.

From September through election day, Kmiec traveled to key states including Indiana, Ohio and Pennsylvania, meeting with groups of people at churches on Obama’s behalf. The election’s focus on the economy was “providential,” Kmiec said. Without the usual single-issue debate about abortion rights among Christian voters, the Obama campaign had the opportunity to make its case on other fronts.

“It moderated, it seemed to me, the amount of time that was devoted to these divisive conversations,” he said.

The election results returned Catholics to their historical Democratic moorings, which many had fled for the GOP during the Reagan years.

“That is opening a door that had been closed for a while,” Kmiec said. But whether it stays open may be determined by whether Obama’s actions match what he promised — and also by what larger political environment defines the 2012 presidential race.

“At some level, if he’s a good president, that will affect evangelicals and non-evangelicals, Catholics,” said Wilcox of Georgetown University. It is too soon, he said, to know whether Obama’s improvements among religious voters indicate a new alignment for Democrats, or were simply a verdict on the 2008 candidates.