The 30-year-old initially left the club earlier this summer, but has failed to get a new club.
Cole returned to train with West Ham last month and has now agreed an initial three-month deal with the club.
Cole will be able to play against Manchester City this Saturday evening.