A Mexican man has been charged over an alleged stabbing and sexual assault on a UK backpacker in Redfern on Tuesday.

Police were called to the backpacker accommodation about 3pm on Tuesday, after the 27-year-old man allegedly forced his way into the woman's room and attempted to sexually assault her.

When the woman resisted, he allegedly left the room and returned armed with a knife, and then allegedly stabbed her a number of times in the neck and chest.

She then allegedly managed to run away and obtain another knife before stabbing him in the chest.

She was taken to the Royal Prince Alfred Hospital where she remains in a stable condition.

The 27-year-old man was taken to the St Vincent’s Hospital and was today charged with grievous bodily harm with intent to murder and aggravated sexual assault with threat to inflict actual bodily harm.

He was refused bail and will appear at the Central Local Court in May.

He remains under police guard in hospital.

The alleged victim was praised by police for her "tremendous" effort in fighting back against her alleged attacker.

NSW Police Detective Inspector Despa Fitzgerald said yesterday the woman was fortunate to have survived the "horrific" attack.

"Luck is the key word, and it's just lucky it didn't hit a major artery in those alleged attacks and for him as well," Det. Insp. Fitzgerald said.