Megapixels matter, but zoom is much more important.
I would go so far as to say that we are at the point now where megapixels really don't matter.
A cellphone nowadays has more pixels than a digital SLR did not very many years ago. But does that mean it takes better pictures? Of course not. In almost all cases, the pixel count is NOT the limiting factor for resolution.
Try zooming in on a cellphone photo. You hit digital "noise" and blurring from the small lens before you start seeing "jaggies" from the actual pixels.
That's a crop from an iPhone 5 which has an 8mp camera. Noisy as anything. And yet I have photos from a (12-year-old) 2mp "proper" camera blown up to poster size on my wall, because it had good optics. (And because I held the camera straght!)
In fact, the modern trend for cramming more and more pixels onto tiny sensors actually leads to MORE noise in your photos. Smaller pixels are more susceptible to noise, all other things being equal.