Ramirez's scoops included a report last year of alleged secret payments to members of Spain's ruling party, which forced Prime Minister Mariano Rajoy to fight off calls to resign.
The paper has vigorously pursued stories of corruption on the right and left, including allegations of fraud involving former officials in the Socialist-run southern region of Andalusia.
El Mundo's owner, Unidad Editorial, said in a statement that the 61-year-old Ramirez, widely known in Spain as Pedro J., was leaving as part of a "new stage in the newspaper's editorial management".
"I understand the decision, but if it had been up to me I would have continued as director of El Mundo my whole life," it quoted Ramirez as saying.
The company praised his "brilliant career".
Ramirez jointly founded El Mundo in 1989 and helped to build it into the second biggest-selling daily in Spain, after the centre-left El Pais.
But the publisher said it was now seeking "to restore economic and financial stability" to the title, which like the Spanish media in general is suffering falling revenues.
It said Ramirez would step down as director after Sunday's edition and be replaced by his deputy, Casimiro Garcia-Abadillo.