The Ravens announced the move late Friday night. Spears is expected to take a physical and sign the deal within the next few days.
Although the Super Bowl champions have lost several key players during free agency, they've enhanced their defensive line by signing Chris Canty and Spears, who has 89 starts over his NFL career.
General manager Ozzie Newsome says, "The base of a good defense is to be good along the defensive line. Spears, like Canty, can play multiple positions along the line. He brings a lot of snaps and big game experience to us."
The Cowboys' move to a 4-3 scheme did not favor Spears, who had played defensive end in the 3-4 since joining the Cowboys in 2005.
Spears played in 15 games in 2012 with six starts. He finished the year with 35 tackles, one sack and two tackles for a loss. He had 10 sacks in his eight seasons.
Information from ESPN NFL Insider Adam Schefter, ESPNDallas.com's Todd Archer and The Associated Press was used in this report.