The 32-year-old Croatian international has penned a season-long contract with the Hammers.
Petric had been looking for a new club after being released by Fulham at the end of last season.
"I'm very happy, excited and looking forward to training with the team and to the first game," he told West Ham's official website.
"There are a lot of good players here and I'm happy to be part of such a good team and I hope we can all celebrate my first goal for West Ham as soon as possible."
Petric enjoyed spells in Switzerland and Germany before arriving in England last summer.