An earthquake has shaken western Sydney after tremors woke residents in the early hours of Wednesday.

The 3.9 magnitude quake hit Appin, 16 kilometres south of Campbelltown, at 1.13am.

Residents in surrounding suburbs including Menangle, Glen Alpine, Wilton, and Campbelltown reported feeling the tremors.

Scroll down for video

A 3.9 magnitude earthquake has struck the suburb of Appin, 16 kilometres south of Campbelltown in Sydney's west

Others said they were woken by a loud rumbling sound.

Local MP Jai Rowell took to social media to urge those in the area to remain calm, and contact the relevant emergency services if necessary.

'It is hard to believe that we have had an earthquake in Wollondilly but we have. (Near Appin/Douglas Park),' he posted to Facebook.