Prime Minister Pedro Sánchez of Spain declared on Monday that he would not resign, nearly a week after publicly raising the possibility in response to corruption accusations against his wife that he and other officials denounced as a smear campaign.

The decision by Mr. Sánchez, who has repeatedly astonished his supporters and frustrated his conservative critics with his knack for political survival, is a momentous one for him, his country and all of Europe.

Mr. Sánchez inspired anxiety, bewilderment and right-wing hopes last week when he responded to the opening of a judicial investigation into his wife by canceling his public schedule and issuing an emotional public letter. He wrote that harassment against his family had become intolerable and that he was considering quitting.

But on Monday he walked back from the precipice after days of apparent reflection out of the public eye. Spain’s public prosecutor’s office had already sought to have the complaint against his wife dismissed for lack of evidence.

“I’ve decided to continue with more strength,” Mr. Sánchez said in a defiant and highly anticipated speech on the steps of Moncloa Palace, the prime minister’s residence.

Mr. Sánchez cast his deliberative period as proof of his humanity — “I have shown a feeling that is not usually admissible in politics” — and of the strength of his marriage.