The signing gives the Rays, who entered play Friday three games out of an American League Wild Card slot, some added depth in the middle infield.
Espinosa has played 85 games this season for the Angels and Mariners, mainly at second base, but he's struggled at the plate, hitting .164/.237/.279 with six home runs and 31 RBIs. The 30-year-old was released by Seattle on Sunday.
Espinosa spent his first seven Major League seasons with the Nationals. Last year, as Washington's starting shortstop, Espinosa hit .209/.306/.378 with a career-high 24 home runs and 72 RBIs.
David Adler is a reporter for MLB.