He still lacks the backing he needs from the second-placed Socialists, but he told a news conference he had agreed to terms demanded by the smaller centrist Ciudadanos ("Citizens") party to win their support.
"We have taken a decisive step towards forming a government so that there will not be another election," Rajoy told journalists after meeting Ciudadanos leader Albert Rivera.
Rajoy said he would ask the speaker of Spain's parliament later on Thursday to set a date for the investiture vote.
Ciudadanos came fourth in the Dec. 20 and June 26 elections.
It had set out a a six-point pact of anti-corruption and political reform measures as a condition of its support.
Even with Ciudadanos, the PP will still be seven seats short of a majority in the 176-seat lower house of parliament, meaning Rajoy needs at least an abstention from the Socialists to win an investiture vote.
The Socialists reiterated on Thursday they would oppose him, but pressure is expected to mount on the center-left party to allow the PP to form an administration.
"As is well-known, the Socialists' vote will be a negative one in the investiture session," the party said in a statement.