Joni Ernst was lagging behind in the race for the Republican nomination for U.S. Senate here in Iowa. She was a relative unknown in a crowded field led by a wealthy businessman. Then she started talking about castrating hogs.

Ernst spent just $9,000 to air her first television ad, but her testimonial — “I grew up castrating hogs on an Iowa farm” — and her promise to apply those pork-cutting skills to “make ’em squeal” in Washington transformed her candidacy.

At a time when voters tune out many political messages, the ad was a vivid reminder of the enduring power of a single image. In the first three days, her 30-second spot was viewed nearly 400,000 times on YouTube and became the talk of cable news, catapulting the state senator from rural Red Oak into the top tier.

NOTE: Sen. Joni Ernst gave the Republican response to the president’s 2015 State of the Union address. Read a transcript of her remarks here.

Ernst, a lieutenant colonel in the Iowa Army National Guard who says she proudly carries a pistol in her purse, followed up last week with her second ad, in which she steps off her Harley-Davidson and, wearing a black leather jacket, fires multiple shots with expert precision at a shooting-range target. The narrator says she’s aiming for President Obama’s health-care law.

Iowa State Sen. Joni Ernst, who is running for the U.S. Senate, in Urbandale, Iowa. (Dan Balz/The Washington Post)

“It is very edgy. I will admit that,” Ernst said in an interview between campaign stops last week.

With three weeks before the June 3 primary, polls show Ernst gaining on Mark Jacobs, a retired Reliant Energy chief executive who moved back to his native Iowa from Texas two years ago. He has poured at least $1.6 million of his own money into the campaign and had been the early favorite to win the nomination. Now, Ernst said, “I consider myself the front-runner.”

The next month will test that bold declaration by Ernst and show whether she can round out the flashy farm-girl persona defined by her ads with the substance, seriousness and expertise befitting a senator.

Jacobs has begun attacking Ernst, and Republicans here expect him to turn up the heat in the final weeks. Jacobs said his business experience gives him an edge.

“There’s substance behind the high-level talking points,” he said in an interview. “I’ve got very specific ideas of how we get the budget balanced, how we create the environment to foster more rapid growth in the private sector.”

Not long ago, the seat being vacated by the retiring Sen. Tom Harkin (D) appeared likely to stay in Democratic hands. But national Republicans have grown bullish about adding Iowa to the long list of Democrat-held Senate seats they could pick up in November’s midterm elections.

GOP officials in Washington say either Ernst or Jacobs would present a good contrast with the presumptive Democratic nominee, Rep. Bruce Braley, a four-term congressman and former trial lawyer.

With Ernst’s newfound stature comes growing scrutiny. After she told the Des Moines Register on Friday she has “reason to believe there were weapons of mass destruction in Iraq,” Iowa Democrats pounced with a statement saying Ernst was perpetuating a “myth” and that her “denial of the facts is very troubling.”

Unlike in other Republican Senate primaries, the two leading candidates here do not represent opposing wings of the GOP. The two candidates most closely aligned with the tea party — Sam Clovis and Matt Whitaker — are underfunded and lagging behind.

Jacobs said that he, unlike Ernst, can campaign this fall against Braley as an outsider. “I think people are sick and tired of the business as usual in Washington, and we’re not going to fix Washington by sending the same type of person again,” he said.

Although Ernst is the only elected official in the race and has the endorsements of GOP establishment figures such as Lt. Gov. Kim Reynolds and 2012 presidential nominee Mitt Romney, her ads have introduced her to Iowa voters as anything but a typical politician and attracted support across the breadth of the party.

Late last month, former Alaska governor Sarah Palin flew to Des Moines for a rally to endorse Ernst. Watching the hogs ad, Palin told the crowd, “It’s like, whoa, nobody’s going to push her around.

Ernst’s hogs ad came about almost by accident. Last year, when Ernst sat down with her advisers to develop a stump speech, she mentioned almost as an aside that one of her chores growing up on the family’s southwest-Iowa farm was castrating hogs. This startled her media consultant, Todd Harris.

“Todd even mentioned: ‘I had no idea what that entailed. I had to go onto YouTube and see how that was done,’ ” Ernst recalled.

That fall at a debate, Ernst tested a one-liner about castrating hogs. The crowd lit up. With the campaign behind in fundraising, Harris and his partners at Something Else Strategies thought that building a provocative ad around that line might get her attention they could not afford to buy.

When Ernst asked how an ad about castrating hogs might be received, Harris told her to “be prepared for a lot of East Coast hyperventilating” but assured her that it would be well received by people in Iowa.

“I’m amazed by how many people know who I am from that ad,” Ernst said. “They’ll say, ‘You’re Joni — and I used to do that when I was a kid, too.’ ”

Ernst said the ad underscores what she sees as the biggest difference between her and Jacobs: their lifestyles.

“I still am a normal Iowan,” she said. “He is a very wealthy man. I live in a home that I bought for $80,000. He lives in a home that most Iowans would never dream of owning.”

Jacobs argues that he, too, had a normal Iowan upbringing before moving away for work. He said his jobs as a teenager, delivering newspapers and scrubbing pots and pans at a Hy-Vee deli, taught him “the value of a dollar.” He said he became the kind of chief executive who “rolled up his sleeves and got his hands dirty traipsing around power plants in jeans and steel-toed boots.”

Advisers to Jacobs say that not every Republican here thinks Ernst’s hogs ad was a political slam dunk. One of them, Douglas Gross, a veteran operative in the state, called it “bizarre.”

“I thought it was a joke, and I was embarrassed by it,” Gross said.

Iowa GOP strategist Nick Ryan also criticized the stark images in Ernst’s second, more provocative ad.

“They put the same wholesome character now in black leather and shooting a handgun actually into the camera on screen,” said Ryan, who is also advising Jacobs.

Gross suggested Ernst’s ads were turning off independent and female voters whom she would need to win over in a general election.

Ernst and her advisers disputed that. “People should remember that Joni is a mom, a grandmother who has volunteered at a crisis hotline, and that part of her bio will be told,” Harris said.

In this last stretch of campaigning, Ernst is on her “Make ’Em Squeal” tour, driving around in a mini-Winnebago emblazoned with her picture. On the rear, above the image of a pig, it says, “Honk if you want to make D.C. squeal.”

“People are honking,” Ernst said. “They know about the ads.”