The two countries signed a memorandum of understanding (MoU) on cooperation in cyber security.
A second MoU was signed on cooperation in renewable energy.
Three other MoUs were signed on cooperation in organ transplantation, technical cooperation in civil aviation, and between the Foreign Service Institute of India and the Diplomatic Academy of Spain.
Two agreements were also signed on transfer of sentenced persons and waiving of visas for diplomatic passport holders.
Earlier in the day, addressing the media ahead of his talks with Spanish premier, PM Modi said terrorism posed the biggest challenge to the world and the fight against this menace formed a key element of India-Spain ties.
PM Modi arrived in Madrid from Germany on Tuesday on the second leg of his six-day, four-nation tour of Europe that will also take him to Russia and France.
This is the first visit by an Indian Prime Minister to Spain in nearly 30 years since Rajiv Gandhi paid a trip in 1988. PM Modi and the Spanish prime minister last met on the sidelines of the G20 Summit in Turkey in November 2015.
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.