Bernie Sanders won Oregon’s Democratic presidential primary on Tuesday, demonstrating once again that his campaign will continue to win states even as his path to the nomination narrows.

Oregon was the first state in the nation to pass a law to automatically register voters who visit the DMV to obtain or renew a driver’s license. Political observers had questioned whether this process would hurt the independent senator from Vermont’s chances, since Oregon’s Democratic primary is closed to unaffiliated voters. Voters registered through the automatic registration process are registered as unaffiliated voters unless they send a postcard back to the state opting to be registered as Democrats or with another party. Sanders has struggled in states with closed primaries.

But Sanders ultimately prevailed in the state, which sends 61 pledged delegates to the Democratic convention this summer. With 75 percent of precincts reporting, Sanders led Clinton, 54.5 percent to 45.5 percent. It's the first time Sanders has won a primary closed to unaffiliated voters.

Sanders had repeatedly visited Oregon to boost his chances there. He held rallies all over the state -- in Portland, Springfield, Salem and elsewhere -- out-campaigning former Secretary of State Hillary Clinton, whose campaign focused more on Kentucky, which also held its presidential primary Tuesday.

Oregon demographically resembles its neighbor Washington state, where Sanders won the caucus in March, in that it has only a small share of voters who aren't white. Clinton has tended to beat Sanders in states with a much higher share of black and Latino voters.

Sanders had projected confidence about his prospects in Oregon, but encouraged voters to return their ballots. Oregon holds a primary conducted entirely by mail; voters have the option of either mailing their ballots back to the state’s elections office or dropping them off at designated ballot-return boxes.

“I am one of the most progressive members of the United States Senate and Oregon is one of the most progressive states,” Sanders told Portland’s KPTV-TV during an interview Sunday. “We think we are going to win in Oregon and it will be a very big victory if the voter turnout is high and people bring in their ballots.”

Clinton will maintain a significant lead in delegates, even with the Oregon loss. Heading into the state’s primary, she had 1,716 pledged delegates, to Sanders’ 1,433. (Clinton’s lead increases if superdelegates are taken into account. If they are, she had a lead of 2,240 to 1,473 before the Oregon and Kentucky contests.)

Sanders’ campaign has said that neither candidate will arrive at the convention with a majority of pledged delegates and that his campaign could still convince superdelegates siding with Clinton to switch their allegiances. He has argued that he would be the best candidate to take on the GOP’s presumptive nominee, Donald Trump, and that superdelegates would change their minds about Clinton if they only paid attention to general election polling showing Sanders performing better against Trump.

The end of the primary is approaching, so Sanders has limited opportunities to make up his delegate deficit. California, New Jersey, North and South Dakota, the District of Columbia, New Mexico and Montana hold the nation’s last Democratic contests in June.