The 30-year-old, who was at the club for seven years prior to his departure, has been working hard on his fitness to try and get a deal and he has now finally proved he is worth a three-month contract.
The need for Cole has been obvious with £15m striker Andy Carroll sidelined by injury, while Modibo Maiga and Mladen Petric have failed to net a Premier League goal between them this term.
Cole is looking ahead to helping out the team, and said: "I'm in an excellent mood, am happy to be back and can't wait to get working with the lads again and start my season off."
Cole could make his second Hammers debut in Saturday's home match with Manchester City.
"I've been working hard with the strength and conditioning coach Mathew Monte-Colombo in the gym and he's been really hands-on with me to get me up to standard to train with the team and get my match fitness up as quickly as possible with a view to signing," Cole added.
"I feel fit and raring to go and it's time to start knocking on the manager's door to get some games under my belt."