PORTLAND — Oregon voters legalized recreational pot use Tuesday, making the state the third to approve the drug for commercial sales.

Legalization backers spent more than $3 million on advertising in the month before the election. Opponents, largely composed of law enforcement and concerned citizens, failed to mount much of a counteroffensive.

Voters in the state rejected a similar bill in 2012. But this time, Oregon’s legalization measure received support from major national donors.

“We know that Oregonians are trailblazers on good policy,” said Brad Reed, Yes on 91 spokesman. “We feel like people took a close look at (the marijuana legalization measure), took a close look at the damage prohibition was doing and made a good decision.”

Colorado and Washington became the first states to legalize pot for recreational use in 2012. Revenue estimates from marijuana taxes in those states so far have failed to meet expectations.

Oregon’s measure calls for pot legalization by July 1, and requires the state Liquor Control Commission to adopt rules by Jan. 1, 2016.

“We’ve waited this long. We can wait a little longer,” said Shane McKee, who supported legalization.

McKee owns a medical marijuana dispensary, Shango, with two locations in Oregon. He expects a crowd of people to turn out at his door Wednesday, seeking pot they believe will be legal immediately.

“We were kidding around, laughing at how many people are going to be there, saying they want legal marijuana,” McKee said. “We don’t expect any immediate impact other than a lot of media coverage.”

The measure prevailed in Oregon’s four largest counties, according to early results, but was trailing in a cluster of smaller counties in rural Eastern Oregon.

The marijuana proposal was expected to do well with young voters. But baby boomers also showed strong support for Measure 91, with about six in 10 people between the ages of 50 and 64 voting for it, according to preliminary results of an exit poll conducted for The Associated Press and the television networks.

Voters who said they were conservative and attended church every week strongly opposed the measure, according to the poll. But liberals overwhelmingly backed it, and six in 10 moderates did as well.

The Willamette Valley, which includes Portland, strongly agreed with the measure, and it was backed by both the poor and voters who make six figures.

Edison Research conducted the survey. A total of 1,003 people who voted early or absentee were interviewed by landline or cellular telephone from Oct. 24 through Nov. 2. Results for the full sample were subject to sampling error of plus or minus 3 percentage points; it is higher for subgroups.

Clatsop County District Attorney Josh Marquis, one of the measure’s most outspoken opponents, said he’s surprised the vote appeared close Tuesday night, given the paucity of spending from his side.

“It was a true David-versus-Goliath moment,” Marquis said. “Marijuana was always a low law-enforcement priority. Now it’s a no-priority.”

Opponents of the measure said they expect more children to have access to the drug, and more car accidents if it passes.

“Unfortunately, I expect a couple more times a year, sitting down with family members involved in car crashes,” Marquis said. “There’ll be more of them involving people impaired (by) marijuana.

“That said, do I think western civilization will come to an end in Oregon? I do not.”

Oregon sheriffs were among the law’s chief opponents. In campaign literature, they warned that legalization would put marijuana in children’s hands and could lead to more people driving under the influence.

Overall, voters were faced with a far quieter campaign than those in Colorado or Washington. They approved medical pot 16 years ago.

In 2013, the Oregon Legislature approved medical marijuana dispensaries. A similar arrangement in Colorado made for an easier transition from medical marijuana to commercial sales.