The 24-year-old Spain international, who moved to Madrid from Real Betis in the summer of 2017, made 37 appearances for the Gunners last season.
He scored the winning goal in the FA Cup quarter-final win over Sheffield United, and started the final as they won the competition for the 14th time.
“Dani was an integral part of our team last season,” said boss Mikel Arteta.
“I love Dani’s passion and commitment and he’s a highly skilful player.
“We’re all delighted to welcome him back and we look forward to seeing him pick up where he left off.”