An earthquake measuring 5.0 on the Richter scale shook parts of Punjab, Haryana and Uttarkashi district of Uttarakhand in the wee hours today.