Both the Amsterdammers and the Spanish champions announced tonight that a deal had been struck to allow Huntelaar - a long-time target for the Spanish side - to join Madrid for an initial 20million euros.

The deal brings to an end months of speculation linking the 25-year-old with a move to the Spanish capital, talk which mounted further following the injury to Madrid's fellow Dutch striker Ruud van Nistelrooy, who is set to be sidelined until the end of the season.

In a statement released on the Real Madrid website, www.realmadrid.es, the club confirmed the signing saying: "Huntelaar is a new Real Madrid player. Real Madrid and Ajax Amsterdam have reached an agreement for the forward.

"As is normal, the deal is dependent on the player passing a medical and the signing of his contract with Real Madrid.

"Klaas Jan Huntelaar will be tied to Real Madrid until June 30, 2013."

The deal will earn Dutch club Heerenveen 2.5million euros as part of the agreement Ajax signed when they bought the player in 2005.

Huntelaar, who had 18 months to run on his Ajax deal, was quoted as being keen on a move to Real during the summer, but Ajax were adamant their star player and the Eredivisie top scorer would remain in Holland.

The prolific frontman was a target for a number of clubs at that time with the Dutch giants reported to have turned down a big-money bid from Manchester City, while Madrid, Manchester United and Arsenal were also apparently keen admirers.

But Ajax technical director Danny Blind decided now was the right moment to let the player go.

"We as a club wouldn't make a deal if we weren't satisfied with the details, but also with the timing of the transfer," he said.

"We did our best to extend Klaas Jan's contract, but we failed. His current contract runs for just one and a half years and we had to take that into account.

"After being at Ajax for three years it's a nice step in his career. He absolutely deserves this transfer."

Ajax coach Marco van Basten was less impressed with the timing of the transfer.

"I don't begrudge him this transfer, but from a sporting perspective we would rather have seen him end the season here," he said.

"Obviously when a club like Real Madrid comes in, it's going to be very difficult to keep him.

"And as a club we must think of more than one player - it's all about having a future-proof policy."

Madrid defender Michel Salgado said he would welcome Huntelaar to the Bernabeu especially as UEFA rules state that the player can be eligible for Madrid's Champions League, having only competed with Ajax in this season's UEFA Cup.

He said: "What we know is that he is a born goalscorer due to the amount of goals he has scored in the Dutch league, he is young and he could play in the Champions League.

"Anyone who comes here will be welcomed."

The deal brings to an end a frustrating time for Madrid in the transfer market after missing out on top target Cristiano Ronaldo in the summer.

Yesterday, Madrid president Ramon Calderon revealed the club were "very close to signing a winger and a striker in January".

He added: "I've been told they are young and quick and they will come to reinforce the team."

Madrid fans have been calling for reinforcements in the midst of a poor start to the Primera Liga season.

The Bernabeu club are currently fourth in the table, six points behind leaders and fierce rivals Barcelona.

Calderon was forced to come out in support of coach Bernd Schuster yesterday for the second time in a fortnight following Saturday's dismal 3-1 defeat to neighbours Getafe.