His conservative People's Party faces difficult negotiations with the far-right Vox after securing the largest share of seats in parliament and ending eight years of a Socialist-led government.
President Trump gloated over the electoral defeat of outgoing Spanish Prime Minister Pedro Sánchez, who had been one of his loudest critics among European leaders.
The election result may clear the way for a PP-led government, but existing spending commitments mean the near-term economic outlook is unlikely to change much.