Robbie Keane has signed a four-and-a-half year contract with West Ham, but the deal will be ripped up if the club are relegated at the end of the season.
• Blog: Obinna hat-trick helps ease pain
West Ham will pay a fee of £5 million for Keane, providing the Premier League's bottom club survive the drop.
The 30-year-old has agreed a two-and a half year contract guaranteed plus an option in the club's favour to take up for a further two years. West Ham are showing enormous faith in the striker, who could be at his last club in the top flight in English football if he sees out the total years on the deal.
In addition, the Hammers have agreed to pay Spurs a £1 million loan fee for the rest of the season, and the deal has gone through just as ESPNsoccernet has been predicting throughout the transfer window after a £4 million move to Birmingham collapsed.
Finally, the Hammers will pick up Keane's £65,000-a-week wages, which makes it a huge investment in the Republic of Ireland international - but well worth it if they stay up. A West Ham insider confirmed: "The deal becomes permanent only if the club stay up."
West Ham have made four signings, and they now have 27 players and would like to sell or loan out two on the final day of the transfer window.
Manager Avram Grant said: "He (Keane) is not just a good player, he is a good character that we need in the next 14 games.''
West Ham co-owner David Gold told BBC Sport: "We're delighted to sign a world-class striker. Tottenham chairman Daniel Levy drives a hard bargain but we've got our man.''
Keane told his new club's official website: ''I am ready to help West Ham stay in the Premier League, which is the most important thing for this club. I am really pleased to have signed and now I just can't wait to start training and playing football.
"I feel as fit as I ever have done in my life and I feel I have plenty left to offer at the highest level for at least the next four or five years. I want to help anywhere I can help the football club, whether that is in training, in the dressing room or on the pitch on a matchday. We have some good players here and I am sure we can stay up.
"When I went on loan to Celtic I scored 17 goals in 19 games and if I can do even half as well as I did there, then I'll be happy.''
He could make his debut in Wednesday's match at Blackpool.
Grant insisted he also intends to add another signing to the reinforcements he has already made to his squad before Monday's 11pm deadline. Gary O'Neil, Demba Ba and Wayne Bridge have all arrived at West Ham during the transfer window.
Obinna scored two goals in the first half against Forest and completed his hat-trick with a penalty in the second after Joel Lynch had brought down Winston Reid.
Grant said of Obinna: "He is a good talent. He has not played so many games in the last few years and he is developing. He will get better and better. He scored three goals but we need him to be efficient in the league games.''
Dele Adebola and Dave McGoldrick scored the goals for a Forest side who were the better team for large periods of an entertaining cup tie which served to highlight West Ham's defensive shortcomings.
Grant, however, was delighted with West Ham's response following their Carling Cup semi-final defeat against Birmingham.
Grant said: "It was very disappointing, the result on Wednesday, especially after the first half when we thought everything was going like we wanted it to. But the most important thing is the reaction and today it was very good. We didn't play well in the first half but in the second half we dominated.''
On a tie against Burnley, Grant added: "It's always good to play at home, they know how to support us and push us. I hope to be in the quarter-finals and then it will be interesting.
"But our target is the league, that is the most important thing, but winning in the FA Cup or the Carling Cup is also a good feeling.''
Nottingham Forest manager Billy Davies was generous towards West Ham although he felt his side could easily have won.
Davies said: "It's nice to come to the academy of football and play the way we did in the first half. We lost a terrible goal after two minutes or so but then deservedly got in front and it looked as if their second goal was fortunate.
"We played fantastic football in the first 45 minutes, flowing, chances galore. In the second half we gave away a goal and after that we were chasing things.
"I am proud of the players. We showed fantastic stuff, but in the end it was down to experience.''
Davies believed it demonstrated what Forest, currently in the Championship play-off positions, could expect to face in the Premier League.
Davies said: "Look at their bench and it has got depth and quality. This is a fantastic football club with a great squad of players. Irrespective of their league position they have got some great players here, real talent. We have got to realise that is what we are facing.
"In the first 45 minutes we looked a very good side, in the second half our inexperience and our tired legs showed, but it was a real big effort.''
Tottenham boss Harry Redknapp said: "I'm afraid the deal is done, we have lost Robbie. I think the chairman has done a deal where we have loaned him and if they stay up then they have to buy him. They have paid the money that the chairman is asking for.''