The 31-year-old made 98 appearances for the German side, scoring 38 league goals after being signed by then-Hamburg boss Martin Jol from Borussia Dortmund in 2008.
Petric has also previously played against his new employers in the 2010 Europa League semi-finals, scoring a goal as his side lost out at Craven Cottage.
The Croatian has appeared for his country 44 times and most notably scored the winner in a 3-2 victory over England at Wembley in a Euro 2008 qualifier.
Speaking at Fulham’s Motspur Park training ground Petric told Fulham's official website: "I like the Premier League and it has always been one of my wishes to come here.
|FA CUP FOR FULHAM?
|30/1||Fulham are 33/1 to win the 2012-13 FA Cup with Paddy Power|
"I played with Hamburg against the club two years ago in the Europa League. It was very nice to play at Craven Cottage with a fantastic crowd and I have enjoyed a good relationship with every member of the Club I have met since.
"I’m very happy to be part of what is happening at Fulham. The club is doing very well and that was why I decided to come here.
"I know the Manager well and I know that he is always looking to strengthen his attacking options and I hope that we can do even better next season.”