Senator Ted Cruz of Texas on Sunday released an advertisement attacking Donald J. Trump for his defense of Planned Parenthood — the most potent signal yet that Mr. Cruz views the issue as a chief vulnerability for his rival in South Carolina.

The ad features interview excerpts in which Mr. Trump argues that Planned Parenthood “serves a good function.”

“With the debt we have, should we even give them a penny?” Sean Hannity, the Fox News host, asks in the clip.

“We have to look at the positive,” Mr. Trump says.

Mr. Cruz clearly views the subject as favorable terrain in South Carolina, which includes a heavy contingent of evangelical voters. He has also sought to sully Senator Marco Rubio of Florida, accusing him of not doing enough to divert funding from Planned Parenthood. The Rubio campaign issued a scathing rebuttal, accusing Mr. Cruz of distortions.

But for weeks, Mr. Trump has been Mr. Cruz’s top target on this score. The Texas senator has highlighted Mr. Trump’s history of left-leaning positions, particularly his self-identification in 1999 as “very pro-choice.”

In the Republican debate on Saturday night, Mr. Cruz seemed to lay a trap of sorts for Mr. Trump, culminating in a very public — if qualified — defense of Planned Parenthood from Mr. Trump.

“You said, ‘Planned Parenthood does wonderful things and we should not defund it,’” Mr. Cruz said.

“It does do wonderful things, but not as it relates to abortion,” Mr. Trump said.

He added, “There are wonderful things having to do with women’s health.”