The quake shook the area at 7:45 am (local time) at the junction of the Minxian County and Zhangxian County, the Gansu Provincial Seismological Bureau said.
The epicenter, with a depth of 20 km, was 170 km away from the provincial capital Lanzhou, state-run Xinhua news agency quoted officials as saying. A 5.6-magnitude quake jolted the same area later at 9:12 a.m, the agency said.
The victims include 19 in Minxian County, two in Zhangxian County in the city of Dingxi and Lixian County in the city of Longnan, according to the officials. Communication was cut off in 13 towns of Zhangxian County.
Officials of with the Minxian County government said most of the townships in the county have been affected by the quake. The townships of Meichuan and Puma were seriously hit.
Many homes in the quake-hit region collapsed, according to the civil affairs bureau of the Dingxi City. The locals in Minxian County said strong tremor was felt in the area and they saw trees and homes were shaking.
They also said that the quake lasted for about one minute. Soldiers, police and more than 300 local militiamen have been dispatched to the quake-hit region to help with rescue efforts.
The provincial civil affairs department has sent 500 tents and 2,000 quilts to the quake-hit region. Lanzhou Railway Bureau has started the emergency response to guarantee the safety of railway bridges and communication equipment in the province.
Light to moderate rain and partly heavy rain were forecast in Dingxi city, according to the provincial meteorological station, which would affect the rescue efforts. Meanwhile, the earthquake was also felt in Tianshui city and the provincial capital city of Lanzhou besides in the cities of Xi'an, Baoji and Xianyang in neighboring Shaanxi Province.