Hamren will replace Lars Lagerback who stepped down after Sweden failed to qualify for next year’s World Cup in South Africa.
Hamren will continue to coach Norwegian side Rosenborg until the end of August next year while he manages Sweden.
“To become the national squad coach for one’s own country has been a big dream for me, and I’m very grateful that Rosenborg has given me this opportunity,” he said.
A statement from the Swedish FA said: “After last week’s breakdown in the negotiations, the two sides have after a few days’ break reached an agreement on Erik Hamren becoming Sweden’s coach.”
Hamren has signed a deal that will keep him in charge of the national team until 2013.
Team president Lars-Aake Lagrell said: “We are very happy and proud to sign Erik Hamren as coach. For the Swedish Football Association, this is a long-term solution.”