Marco Rubio has been remarkably upbeat in the wake of primary losses. Now he's staking everything on Florida. (Peter Stevenson/The Washington Post)

Donald Trump is in a tight contest with Marco Rubio of Florida in the U.S. senator’s home-state Republican presidential primary, according to a new Washington Post-Univision News poll.

Trump edges out Rubio slightly: 38 percent to 31 percent among likely Republican voters in the Sunshine State. Sen. Ted Cruz (R-Tex.) places third with 19 percent, followed by Ohio Gov. John Kasich at 4 percent.

The Florida Republican primary Tuesday is a must-win for Rubio, who has suffered through a string of humiliating losses in recent days that yielded him no delegates. He trails Trump and Cruz in the delegate race but has vowed to stay in the race even if he loses his home state.

Across Florida, Republican support divides along gender, racial and generational lines. Trump holds a double-digit edge over Rubio among white voters (42 percent to 28 percent), while Rubio leads Trump by 49 percent to 20 percent among Hispanic Republicans, with Cruz at 21 percent. Trump leads Rubio by 12 points among voters 50 and older, while they are nearly tied among those younger than 50 (37 percent for Rubio vs. 35 percent for Trump). And Trump holds a 13-point lead among men (42 percent to 29 percent), while he and Rubio are about even among Republican women — 35 percent for Trump and 33 percent for Rubio.

A majority of Florida Republicans — 59 percent — think Rubio should bow out of the presidential campaign if he does not win the state’s primary; 33 percent say he should keep running.

The poll was taken March 2 to 5, preceding Rubio’s losses Saturday night in Kansas, Kentucky, Louisiana and Maine. He won the Puerto Rico primary Sunday but placed third or fourth Tuesday night in Hawaii, Idaho, Michigan and Mississippi. Those losses could be a factor for voters when deciding whether Rubio’s candidacy is viable.

The survey was also taken just as several political groups began airing tens of millions of dollars in attack ads against Trump, targeting his business practices and caustic rhetoric. But Florida Republicans have largely favorable opinions of Trump.

More than half — 57 percent — view the New York businessman favorably, compared with 39 percent who view him unfavorably. Rubio is seen in a slightly more positive light, with 62 percent rating him favorably while 31 percent view him unfavorably. And while 24 percent find Trump “very unfavorable,” only 13 percent say the same of Rubio. Cruz is viewed positively by 56 percent of Florida voters, compared with 35 percent who are unfavorable toward him.

Among Hispanic Republicans, Rubio has the highest favorability mark at 76 percent, slightly higher than Cruz’s 68 percent positive rating but far higher than Trump’s 36 percent favorable rating. More than 6 in 10 Hispanic Republicans report an unfavorable opinion of the GOP front-runner.

Looking specifically at different candidate attributes, Florida Republicans rate Trump as having the best chance compared with Rubio and Cruz of being elected president in November (60 percent) and the candidate who could best bring needed change to Washington (55 percent). By a smaller margin, Trump edges out Rubio on who is closest to them on the issues (39 percent for Trump; 32 percent for Rubio).

But Rubio is seen more positively on other attributes: He leads Trump by 13 points and Cruz by 14 points as the candidate with the best personality and temperament to serve as president. Roughly similar shares pick Rubio and Trump as the most honest and trustworthy candidate (34 percent vs. 30 percent), while 21 percent say this of Cruz.

Republicans trust Trump more to handle several issues. More than half (56 percent) say they trust Trump most to handle the economy, and a 45 percent plurality say they trust him most to handle immigration. An identical 45 percent trust him most to handle the threat of terrorism. Trump’s edge is smaller on health care, with 36 percent trusting him, compared with 29 percent for Rubio and 23 percent for Cruz.

One of Trump’s mainstay issues, temporarily banning Muslims who are not U.S. citizens from coming into the country, is supported by a majority of Florida Republican likely voters. In all, 57 percent support banning Muslims — 39 percent “strongly support” such an action. Seventeen percent are strongly opposed.

The issue of Cuba resonates in Florida like no other state. President Obama plans to visit the island nation this month, making him the first sitting president to do so in 88 years. In Florida, 59 percent of all Republicans disapprove of Obama’s visit. Notably, 66 percent of Florida’s Hispanic Republicans agree that Obama should not visit Cuba. A 51 percent majority of all Republican voters support ending the “wet foot, dry foot” policy allowing Cuban refugees to stay in the United States if they reach the shores of the country.

Meanwhile, a majority of Florida Republicans, 72 percent, think the Senate should delay a vote on a replacement for Justice Antonin Scalia until the next president takes office. And a majority, 62 percent, oppose providing financial assistance to Puerto Rico to avert a default on its debt. Here, Hispanic Florida Republicans are split: 41 percent support assisting Puerto Rico financially while 44 percent oppose such action.

Florida Republicans cite jobs and the economy as the most important issue when deciding their vote (43 percent) followed by terrorism (27 percent), with foreign policy (8 percent) and immigration (6 percent) ranking further behind. Most of the state’s Hispanic population is either Cuban or Puerto Rican, two groups less affected by immigration policy, since Puerto Ricans — as U.S. citizens — can easily migrate from the island territory, and federal law grants protection to Cuban immigrants who reach the United States.

Rubio’s decision not to run for reelection to the Senate has sparked a crowded race to succeed him, with contested primaries on both sides of the aisle.

On the Republican side, 74 percent of Republican primary voters remain undecided about a Senate candidate. No candidate breaks out of the single digits: Two contenders, Lt. Gov. Carlos López-Cantera and Rep. Ron DeSantis (R-Fla.), stand at 6 percent, while Rep. David Jolly (R-Fla.) receives 5 percent. Candidates Todd Wilcox and Carlos Beruff trail further behind.

The Post-Univision poll surveyed a random sample of 450 likely voters ahead of Tuesday’s Republican primary, including interviews on conventional and cellular phones. The survey included an oversample of Hispanic likely voters, which were weighted back to an estimate of their share of the primary electorate. The margin of sampling error is plus or minus 5.5 percentage points for overall results; the error margin is 9.5 points for results among the sample of 164 Hispanic likely voters.

The survey was conducted by the independent firm Bendixen and Amandi International and the Tarrance Group, a Republican firm.

Scott Clement contributed to this report.