NEW YORK — The Tampa Bay Rays have signed veteran shortstop Alexei Ramirez prior to Thursday night’s game against the New York Yankees.

Ramirez was released by the San Diego Padres on Sunday after losing his job as the team’s starting shortstop.

Ramirez, who turns 35 on Sept. 22, hit .240 with five homers and 41 RBIs in 128 games with San Diego, starting 109 games at shortstop, three in right field and one at designated hitter. Padres manager Andy Green said Ramirez “didn’t have the range at shortstop anymore that we need” after Ramirez was released.

Ramirez, a 2014 All-Star, signed with the White Sox out of Cuba before the 2008 season and hit .273 with 109 home runs in eight years with Chicago. He signed as a free agent with San Diego in January, agreeing to a deal that included a $3 million salary this year and a 2017 mutual option with a $1 million buyout.

Tampa Bay pays $69,331 for the rest of the season, a prorated share of the big league minimum that offsets a portion of what the Padres owe.