Martin will earn $3 million this season, $4 million in 2008 and $4.5 million in 2009.
"Paul Martin is an all-situations type of defenseman and has developed into one of the more talented young players in the National Hockey League," Devils chief executive Lou Lamoriello said.
With the departure of Rafalski, Martin is prepared to assume a bigger leadership role.
"As a player, you always want to step in and take over that role," he said.
Martin had three goals and 23 assists last season while playing in all 82 regular-season games. He added four assists in 11 playoff games.
The 26-year-old defenseman has 14 goals and 73 assists in 232 games.
Martin said he had a short chat with new coach Brent Sutter last month.
"The Sutter name has a lot of tradition in hockey and a reputation for making sure you are accountable as a player," Martin said. "It will be good to get us back on track, and I'm looking forward to it."
Martin is also pleased that Sutter hired Larry Robinson as an assistant coach.
"Having him back behind the bench would be beneficial," Martin said of Robinson, the former Devils head coach who led them to a Stanley Cup title in 2000.