Angel Lafita netted a fifth-minute goal for the visitors at the Santiago Bernabeu on Sunday, darting forward from deep before unleashing a strike that deflected in off Pepe.
But Real fought back to take three points as Pepe atoned for his error by notching an equaliser before further goals from Cristiano Ronaldo either side of an Isco strike decided the game.
And Di Maria - who came into the team late on after Gareth Bale suffered an injury while warming up - was delighted with the hosts' performance.
"We played a great match," he said "We started pretty well but had bad luck with a deflection for Getafe.
"We knew that we could turn it around, we have the type of players to do it and we are confident in ourselves."
The only sour point from Di Maria's perspective was the jeers Real fans aimed at striker Karim Benzema after the Frenchman missed a host of chances in the second half.
He added: "I found the whistles to Karim ugly. (Alvaro) Morata missed another and nobody whistled him. You must be fair with everybody."
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.