The Dodgers announced the deal before their game against the Cincinnati Reds.
The 34-year-old Barajas, who is from Ontario, Calif., hit .225 with 12 homers and 34 RBI in 74 games with New York this year. He came off the 15-day disabled list Thursday after being sidelined with a strained left oblique.
The Mets called up outfielder Jesus Feliciano from Triple-A Buffalo to take Barajas' roster spot. Feliciano hit .342 with one homer and 26 RBI in 78 games for Buffalo.
Barajas has played for Arizona, Texas, Philadelphia, Toronto and the Mets during his career that began in 1999. He has hit 104 career homers, including a career-high 21 with Texas in 2005.