Kevin Rudd has prevailed in a dramatic Labor leadership ballot, defeating Julia Gillard 57-45 and paving the way for him to return to the prime ministership.

The vote was the third time the Labor leadership has come to a head this Parliament, after Ms Gillard overthrew Mr Rudd in 2010.

Her defeat means Ms Gillard will quit politics at the next election, following her vow to retire if she should lose.

Wayne Swan has quit as deputy leader and has been replaced by Anthony Albanese, while Penny Wong will replace Stephen Conroy as Labor's Senate leader.

Frontbenchers Greg Combet, Peter Garrett, Joe Ludwig and Craig Emerson have joined Mr Swan and Senator Conroy in quitting Cabinet following the vote.

Read the story here, and look back at how our rolling updates, images, video and analysis unfolded.