This is in spite of the failure of early talks with EU leaders in January, where UK prime minister Theresa May said her offer to guarantee the rights of EU citizens in the UK has been rebuffed by “one or two” European leaders including, it is rumoured, Angela Merkel.
Rajoy told French newswire AFP: “I am absolutely convinced that we will reach an agreement so that these people will not be affected by political decisions.”
“I hope that we will soon be able to tell them: Don’t worry, nothing is going to change for the Spaniards in the United Kingdom, nor for the Britons in Spain.”
Spain is the most popular European retirement destination for Britons with up to one million Brits estimated to be living there.
Of particular concern is healthcare coverage.
According to Spanish social security data, Britons cost Spain €285m (£243m, $303m) in health care last year, including tourists and pensioners and accounting for nearly half of Spain's total spend on foreign European Union nationals.
Rajoy said the negotiations would start once Britain formally triggers Article 50 in March.
May has also said this is a priority. In a recent speech, she said: “We want to guarantee the rights of EU citizens who are already living in Britain and the rights of Britons in other member states as early as we can.”
Rajoy also reiterated that he would use Brexit to renegotiate the status of Gibraltar with London. “We are going to ask that all decisions affecting Gibraltar be made bilaterally between the United Kingdom and Spain,” he said.