The 28-year-old is under contract in Bremen until 2012 and has scored 30 goals in 90 Bundesliga games, but has been told his first-team chances will be limited this season.
Bremen will face holders Inter Milan, Premier League side Tottenham Hotspur and Dutch outfit Twente in Group A of the Champions League.
Rosenberg played a big part in helping Werder reach the Champions League group phase by scoring the valuable away goal at Sampdoria in the 3-2 defeat after extra time in the qualifying match, which put the Germans through.
“This is a reasonable solution for all parties,” said Werder’s manager Klaus Allofs. “Markus wants to play, but we could not guarantee him matches, despite his improving form and help in getting us into the Champions League.”
Rosenberg, who joined Werder from Ajax Amsterdam in 2007, said he is looking forward to the new challenge in Spain.
“In this situation, I have a clear perspective in my mind. I’m sure I’ll come back stronger,” he said.