Amid the attack ads and accusations that distinguished the Republican presidential contest here, the choice on Tuesday came down to a simple question: Who can beat President Obama?

Nearly half of the voters in this state’s primary said their top priority was unseating the incumbent president, and of that group, most backed Mitt Romney, according to exit polls. The former Massachusetts governor scored a decisive victory in Tuesday’s primary, despite his struggles in the past to convince Republican voters that he is the most electable candidate in the field.

Romney won over the largest and most diverse electorate that has yet participated in the 2012 election, a population that includes large numbers of evangelical Christians, tea party voters and Cuban Americans. And he won the backing of an electorate that was more conservative than those in previous contests, overcoming concerns that he is too moderate.

In interviews, voters cast Romney as a pragmatic and measured choice compared with his main foe, Newt Gingrich, whom they often described as intelligent but impractical. But voters had to look beyond the insults the two men hurled at each other in the most negative contest yet of the presidential race.

“I was looking at the big slugfest between Mitt and Newt, and I went with who would do better against Obama and who would tell the truth,” said Trisha Talley, 27, who cast her ballot at a church here around midday Tuesday. “I went with the person who got the least Pinocchios, and that was Mitt.”

But the results in a state that has outpaced the country in unemployment and foreclosure rates also show potential weaknesses for Romney going forward.

In the campaign, Romney has touted his credentials as a successful entrepreneur and corporate turnaround artist, a message he hoped would have special resonance here. He ran closely with Gingrich among those who see their families as “falling behind financially.”

Some voters said a feeling of “malaise” stemming from persistent financial problems is palpable in the state.

“You see businesses that have been there forever close down. You see houses maintained real nice, and the next thing they look like a crackhouse because the owner just walked out on it,” said Andy Shillinglaw, 55, a retired Marine from Tampa who voted for Romney. “There’s like a malaise. There’s stuff you feel, but you can’t really put it into words.”

Gingrich, Shillinglaw said, turned out to be “the biggest joke.” It was a view shared by others who said they were taken aback last week when Gingrich promised to establish a U.S. colony on the moon if elected president.

“I don’t agree with Newt Gingrich on wanting to go to the moon. We don’t have the money for that,” said Frank Mancuso, 46, an Orlando resident whose support for the space program goes deep enough that he showed up to vote in a Kennedy Space Center T-shirt.

The contest also showed that Romney had improved his standing among Hispanics — a group that will have a significant impact in the general election.

Romney struggled badly among Hispanic voters in Florida when he ran for president four years ago, winning 14 percent of Hispanics, compared with 34 percent of white voters. Among Cuban Americans, who make up most Hispanic GOP voters in the state, Romney garnered just 9 percent that year. This year, though, he gained the support of nearly six in 10 Cuban Americans in preliminary exit polls.

Romney had their support this time because the economy is front and center and because he appeared best equipped to deal with that issue, said Rep. Ileana Ros-Lehtinen (R-Fla.), a Romney supporter who has deep ties in the Cuban American community.

“The number one issue is the economy and jobs, and I believe that Mitt’s rising poll numbers among the Hispanic community are indicative of Hispanics trusting Mitt Romney to fix our economic situation,” she said Tuesday.

In the general election, both parties will reach out to Hispanics, and Cuban Americans tend to differ politically from other Latinos, who are less likely to lean Republican and more likely to list immigration as a major issue.

In interviews, many voters noted the particularly negative nature of the campaign in Florida — a factor that may have helped Romney but that turned off some voters.

The Romney campaign and friendly groups spent heavily on Florida airwaves to highlight Gingrich’s vulnerabilities. Among those who said campaign ads were an important factor in their vote, Romney beat Gingrich by about 30 points. He won by single digits among those seeing ads as less crucial.

“It wasn’t so much that Romney convinced me, but Newt just didn’t look good in the debates or in some of the ads,” said Diane Pelletier, 71, a retired nurse who voted here Tuesday. “It just seems like Romney has a better attitude and way of thinking, and his proposals sound good on the economy and promoting jobs.”

Polling analysts Jon Cohen, Scott Clement and Peyton Craighill and staff writer Rosalind S. Helderman contributed to this report.