The 31-year-old, who has made 88 appearances for Romania, has penned a one-year contract with the Hammers having an option to extend the deal for a further two or three years.
Rat departs Shakhtar having made 248 appearances during his decade-long spell at the club, with 57 of those coming in the Champions League.
West Ham boss Sam Allarydce expressed his delight at the deal, telling the club’s official website: "I'm hugely happy that we've got a player of his experience and his character. He's been playing Champions League football this year and at the highest level for many years. Shakhtar had offered him a very good contract, but his ambition was to come and try his abilities and skills in England.
"When you hear somebody speak so positively about that, then you know they've got the mental character that's needed to do well in this division. We certainly know he's got the ability and he's at an age where he's still capable of producing at 31. He speaks perfect English, which he taught himself, and that shows the discipline and the character of the man.
"Discipline, character and ability are the three big things in the Premier League, and with a little bit of adjusting, we'll see him early on in the season giving hopefully his best performances for West Ham."