  Aims. Rotation periods of cometary nuclei are scarce, though important when
studying the nature and origin of these objects. Our aim is to derive a
rotation period for the nucleus of comet C/2004 Q2 (Machholz). Methods. C/2004
Q2 (Machholz) was monitored using the Merope CCD camera on the Mercator
telescope at La Palma, Spain, in January 2005, during its closest approach to
Earth, implying a high spatial resolution (50km per pixel). One hundred seventy
images were recorded in three different photometric broadband filters, two blue
ones (Geneva U and B) and one red (Cousins I). Magnitudes for the comet's
optocentre were derived with very small apertures to isolate the contribution
of the nucleus to the bright coma, including correction for the seeing. Our CCD
photometry also permitted us to study the coma profile of the inner coma in the
different bands. Results. A rotation period for the nucleus of P = 9.1 +/- 0.2
h was derived. The period is on the short side compared to published periods of
other comets, but still shorter periods are known. Nevertheless, comparing our
results with images obtained in the narrowband CN filter, the possibility that
our method sampled P/2 instead of P cannot be excluded. Coma profiles are also
presented, and a terminal ejection velocity of the grains v_gr = 1609 +/- 48
m/s is found from the continuum profile in the I band.
