Danilo has been in fine form for Porto this seasonReuters

Real Madrid have officially announced the capture of Porto right-back Danilo on a six-year deal for a reported transfer fee of €31.5 million.

The 23-year-old Brazilian, who joined Porto from Santos for a reported transfer fee of €13 million in the summer of 2012, was being linked with a summer move to the Bernabeu.

Danilo had also admitted that he was proud after being aware of the interest from Carlo Ancelotti's side.

And now the Los Blancos have confirmed that they have successfully reached an agreement with Porto and the Brazilian will be moving to the Bernabeu when the summer transfer window opens.

"Real Madrid C. F. and FC Porto have reached an agreement over the transfer of Danilo, he will join the club next season and has a contract until 30 June 2021," read a statement on the club's official website.

The news was also confirmed by Porto via their official website.

"Porto hereby informs the market that it has reached an agreement with Real Madrid for the permanent transfer of Danilo for the value of €31.5m," the Portuguese club said in a statement in their official website.

Barcelona were also believed to be interested in Danilo, who has been one of the main reasons behind Porto reaching the quarter-final of the Champions League, but Real Madrid have emerged triumphant in the race to secure the Brazilian's signature.

However, the signing of the Brazilian right-back has put Real Madrid's current first choice right-back Dani Carvajal's future in doubt.

Meanwhile, Mexican striker Javier Hernandez admits that his time at Real Madrid has been very "frustrating" due to him only getting 590 minutes of playing time season.

The 26-year-old, who joined Real Madrid on a season long loan from Manchester United last summer, has only had a bench role at the Bernabeu this season, with manager Ancelotti preferring the likes of Karim Benzema and Jese over the Mexican.

And Hernandez admits that the situation at Real Madrid has been "frustrating" and his limited first-team chances has affected his overall confidence

"My situation is frustrating. I participate, give my all in training, but as far as for playing in matches, the opportunities are minimal. I belong to a team, but am not part of the important bit, the actual games," the striker told Fox Sports.

"Sometimes my confidence is right down on the ground, even though I am trying for it to be up there, with the help of the people who are always at my side and who support me."