"Marcos is a player that I have known well for a very long time," Sunderland head coach Gus Poyet told the club's website on Monday. "He was desperate to come and play for Sunderland and he is a player I am excited to work with."
Poyet has made new signings a priority in the weeks after taking on the role in October following the dismissal of former boss Paolo Di Canio.
Only fellow strugglers Fulham have conceded more goals than Sunderland in the Premier League this season.
The transfer will not be completed in time for Wednesday's home match against out of form Aston Villa but Alonso could make his debut in the FA Cup third round tie against lower league Carlisle United at the Stadium of Light on Sunday.