Both right-handers avoided salary arbitration with the deals announced Friday.
The 29-year-old Johnson led the majors with a franchise-record 51 saves last season. He went 2-1 with a 2.49 ERA and won the Rolaids Relief Man of the Year award.
Johnson asked for $7.1 million in arbitration and was offered $5.7 million when teams and players swapped proposed salaries. He earned $2,775,000 last year.
Hammel, 30, was 8-6 with a 3.43 ERA in 20 starts for Baltimore last season. He requested $8.25 million while the Orioles countered at $5.7 million after he made $4.75 million in 2012, his first season with Baltimore.
The only Orioles player left in arbitration is reliever Darren O'Day. He submitted $3.2 million, with the club at $1.8 million.