CHICAGO -- Pitcher Carlos Villanueva and the Chicago Cubs have completed a $10 million, two-year contract.

Villanueva will earn $5 million annually as part of Saturday's deal. The sides had agreed to the contract in mid-December, pending a physical.

The 29-year-old right-hander spent the past two seasons with Toronto. He went 7-7 with a 4.16 ERA last year in 16 starts and 22 relief appearances. He slid to 0-3 with an 8.10 ERA in five September starts.

Villanueva spent the previous five seasons with Milwaukee. He has a 33-35 career record with six saves and a 4.26 ERA.

To clear a roster spot, the Cubs designated right-hander Lendy Castillo for assignment.