A 25-year-old man from Melbourne's west has pleaded guilty to raping and attempting to murder a 14-year-old girl.

Michael Hermogenes, of Tarneit, attacked the girl at her home last year before dousing her body with petrol and setting her alight.

The court heard he met and befriended her on the social networking website Facebook.

The victim survived the attack but suffered extensive burns.

Hermogenes will return to the Victorian Supreme Court to be sentenced at a later date.