At least 19 people were killed in Colima state, the state governor said, and authorities said two people died in neighbouring Jalisco state.
The quake, estimated at 7.6 magnitude, was the strongest to hit Mexico in seven years.
Strong tremors were felt in Mexico City, 500 kilometres (300 miles) away from the epicentre, where a number of buildings were evacuated after cracks appeared in them.
The earthquake struck at about 2000 local time (0200 GMT) on Tuesday, lasting more than 20 seconds.
Several people were killed in Colima city when buildings collapsed. A massive rescue operation has been launched in the state, where many more people are feared trapped.
"There is extensive damage to homes, mostly in the state capital," Governor Fernando Moreno told Televisa news.
Much of the area is mountainous and President Vicente Fox has ordered soldiers to go to outlying villagers to search for survivors. Telephone lines have been jammed because of excessive demand so it is difficult to gauge which areas have been worst affected.
The BBC's Nick Miles said there was panic in Mexico City as some buildings swayed and power supplies were temporarily cut.
Some tower blocks were evacuated after cracks appeared, but so far it appears there has been no major structural damage.
"The lamps were moving terribly. It was terrible," said an elderly woman in the capital.
Vulnerable city
Our correspondent says Mexico City has been let off lightly considering the size of the earthquake.
The capital is particularly vulnerable to earthquakes, as the city sits on the silt of an old lake bed, which tends to amplify seismic waves.
Thousands of people died in an earthquake that hit the city in 1985.
Since then, the authorities have strengthened buildings, devising a number of modifications to withstand tremors.
The city's schools and public places are regularly drilled to prepare for a possible evacuation.
Have you been affected by the quake? Send us your experiences using the form below.
Is there any contact numbers for the British Embassy? I have a friend in Mexico City who I am worried about now. Laura, if you read this, let me know you are safe.
Chris Tate-Davies, UK
My girlfriend is working near Guadalajara in a small town to the east. I don't know how she is, but I hope she is okay. There is no way for me to contact her at the moment, so I just have to sit patiently until the chaos has settled a little. I have e-mailed her and I wait in anticipation for her response. If you have any information regarding the effect of the quake in surrounding Guadalajara can I be informed?
Many thanks.
Steven R Manning,
England
Mr. Manning: I spoke with my parents who live in Guadalajara at 7:30 US EST and they informed me that the Guadalajara metro area was minimally affected by the quake. I was told that there were no reports of any damaged buildings nor people hurt as a direct result of the quake. If you can read Spanish, I would highly recommend going to http://www.informador.com.mx which is the site for one of Guadalajara's largest daily newspapers and will have much more detailed news on the quake's effect on the Guadalajara area.
Andre N Sanchez,
USA
Dear Steven, go to google.com, translate this link from Spanish to English, and you will get detailed news that you are looking for http://www.informador.com.mx/
informa/linea/21um92b.htm
Jay,
USA
To Mr. Manning: The effects in Guadalajara were not serious. It was quite strong and lasted a good 45 seconds. I have not heard of major structural damages nor injuries here in Guadalajara and vicinity. Unfortunately, that is not the case in Colima. Keep in mind Colima (city) is a good 3 hours ride from Guadalajara. I bet your friend is OK.
Norman Pimentel,
Mexico
To Steve Manning: Guadalajara is fine, by the way it is the second largest city in Mexico, I live a half hour away from there closer to Colima where the quake hit. It was certainly felt, but no damage.
Anna,
Mexico
Zoe, my youngest daughter, and her friend are in the area - hopefully safe. If you read this, Zoz, let us know at once.
Hugh Hodge, South Africa
My sister-in-law lives in Colima City, where the most damage has been reported up to this moment. We have heard from her and she is fine and her home is standing. But she has gone to stay with her mother-in-law in another part of Colima City which they consider a safer dwelling. While the damage in Colima City sounds substantial, I am more concerned about the city of Tecomán about 40 km to the SW. The USGS web site puts the epicentre of the quake about 13km S of Tecomán, a city of 75,000 with a lower standard of living, generally speaking, than Colima City. I have not seen reports about Tecomán yet, but I would fear horrific damage and many deaths.
Jay Baldwin,
USA
Working in Guadalajara at the moment. The quake lasted about 40 seconds. No damage reported in the city. Outlying areas, I do not know.
Paul Maxwell, Scotland/Mexico
I'm a British teacher living in Mexico City and I live in the mountains but felt the quake last night. My friends living downtown obviously felt it very strongly and had to evacuate their buildings. My colleague Kate said all her furniture was moving and she was afraid a heavy wardrobe was about to topple over.
Anne-Marie Ohene-Kena,
Mexico
We live in the west of Mexico City on the hills overlooking the city. Myself and my work colleagues who live in the areas known as Lomas de Chapultepec, Las Herraduras, Interlomas, etc did not feel the quake at all, and learned about it from concerned family and news reports.
John Barrett,
Mexico
I'm an expat living in Mexico City. It was my first experience of a semi-hard earthquake and quite a scary one! I was lying on my bed watching TV on the 1st floor and the bed starting swaying from side to side. My wife told me to quickly get under a doorway, which has more structural support. We do get light tremors here quite regularly and normally you can't even feel them. The worst quakes are when you get not only the side-to-side motion, but vertical movements also. In the Mexico City 1985 earthquake my brother-in-law saw a painting on the wall rotating rapidly due to the two-way motion and another friend who worked on the upper levels of a hospital could see the sky then the ground through the window due to the enormous sway.
R Potter,
Mexico
The quake hit as I was reading my email last night. It was a strong one, but compared to the big 1985 quake it was nothing. I can safely say that we in Mexico City are pretty used to big quakes now and don't panic very easily.
Humberto Gumeta, Mexico
Disclaimer: The BBC will put up as many of your comments as possible but we cannot guarantee that all e-mails will be published. The BBC reserves the right to edit comments that are published.