He was drafted 95th overall by the Los Angeles Kings in the 2007 NHL Entry Draft while playing for Miami University. He made his professional debut for the Kings' American Hockey League minor league affiliate, the Manchester Monarchs, in 2008. A year later, he was announced to the opening roster for the 2009–10 season with Kings, in which he played four games and had no goals and no assists on six shots on goal. He was sent back down to the Manchester Monarchs for the first 20 games of the 2010–11 season. On November 23, 2010, he was recalled by the Los Angeles Kings to replace the struggling Jake Muzzin. On November 24, Martinez scored his first NHL goal, on the power play, in 4–1 loss to the Montreal Canadiens at the Bell Centre against goaltender Carey Price. Martinez had his first multi-point game December 4, 2010, including a goal against Chris Osgood of the Detroit Red Wings in a 3–2 victory for the Kings. After joining the squad for the 2010–11 season, Martinez earned trust from former Kings Head CoachTerry Murray for solid offensive and defensive play, and that continued after Darryl Sutter replaced Murray in December 2011. On July 8, 2011, Martinez signed a two-year, $1,475,000 contract with the Kings. On June 11, 2012, the team won the Stanley Cup. With the 2012–13 NHL season being threatened by a lockout that ultimately wiped out half the season, on December 31, 2012, Martinez signed with the Allen Americans of the Central Hockey League. He played with them until the end of the lockout. Martinez was injured for 10 of the Kings' first 15 games of the 2013–14 season, but wound up returning as a regular on the Kings' defense, even contributing to the team's offense. On December 4, 2014, Martinez signed a 6 year $24 million extension with Los Angeles. He scored two series winners en route to the Kings' second Stanley Cup title – on June 1, 2014, Martinez scored 5:47 into overtime of Game 7 of the Western Conference Finals against the Chicago Blackhawks; 12 days later, in Game 5 of the 2014 Stanley Cup Finals against the New York Rangers, a shot by Tyler Toffoli, which rebounded off goaltender Henrik Lundqvist in double overtime, led to another Martinez goal. The goal was scored with 5:17 left in double overtime as he became only the 17th man in Stanley Cup playoff history to score the Cup-winning goal in overtime. He became the first to do it since Patrick Kane in 2010 and the first to do it at home since Bob Nystrom in 1980.
On February 19, 2020, Martinez was traded to the Vegas Golden Knights in exchange for a second-round pick in the 2020 and St. Louis' second-round pick in the 2021 NHL Entry Draft. Martinez had a successful debut with the Golden Knights, scoring a goal and an assist in a 5-3 win over the Tampa Bay Lightning.