Errol Louis is the host of "Inside City Hall," a nightly political show on NY1, a New York all-news channel. The opinions expressed in this commentary are solely those of the author.

(CNN) Hillary Clinton dodged a major gut punch Tuesday night in the Kentucky Democratic primary, eking out a victory that will give her about half of the 60 delegates up for grabs -- and raise the possibility of putting the normally Republican state in play in the fall election.

Clinton's victory won't put a definite end to the campaign of Bernie Sanders, who had a respectable showing and also won in Oregon on Tuesday. But victory in the Bluegrass State helps Clinton avoid an embarrassing loss in a state that was always, to a great extent, hers to lose.

Among Democrats, Kentucky has long been Clinton country: she won 65.5 percent of the vote in the 2008 primary against Barack Obama's 29.9 percent. Bill Clinton also carried the state in 1992 on his way to the White House, and again in 1996.

That made Kentucky a likely place for Clinton to reverse a string of losses to Sanders in Michigan, Indiana and West Virginia. Faced with the need to bolster the morale of her team and arrive at the July national convention showing showing strength, Clinton mounted a serious effort in the state.

Her campaign blasted a string of television and radio ads over Kentucky airwaves in the days leading up to the primary. The decision to spend money in Kentucky marked a major departure from the virtually nothing it spent on media in Indiana (a state Clinton lost to Sanders, who spent almost $2 million there ).

Clinton also physically campaigned heavily in Kentucky, making three swings through the state over the last two weeks, holding 11 campaign events.

A loss would have been a major blow since the closed primary rules allow only registered Democrats in the state, which meant Sanders' independent base couldn't make much of a showing. But beyond winning another bucket of delegates -- possibly slightly extending a nearly insurmountable lead in the delegate count -- a Clinton win would raise the possibility of repeating her husband's performance by winning in Kentucky come Election Day.

"Everybody's ready to go vote," Clinton said at a campaign stop in Paducah on Monday. "I'll tell you this: I'm not going to give up on Kentucky in November."

That's not out of the question. A survey conducted in early March showed Kentucky voters favored Clinton over Sanders -- and the same poll showed Clinton with a 16-point lead over Republican Donald Trump.

That may be why Clinton spent a considerable amount of time in Kentucky attacking Trump rather than Sanders. At one campaign stop , she even mocked the presumptive Republican nominee, pretending to supply his answer to the question of job creation. "I'm gonna create 'em, they're gonna be great, I know how to do it -- but I'm not telling you what it is I'm gonna do," she said.

Kentucky is normally a reliable Republican state, giving Mitt Romney 60% of the vote to Barack Obama's 38%. But those two wins by Bill Clinton in the 1990s, and an earlier win in 1976 by Jimmy Carter, suggest that Democrats might be poised for a comeback.