We investigated the dynamics of head-on collisions between a moving droplet and a stationary droplet on a surface with a wettability gradient. The mixing of fluids is achieved passively through convective mass transfer caused by the release of surface energy during coalescence, and also through diffusive mass transfer. The coalescence dynamics were visualized with a high-speed camera; the internal flow patterns were resolved with measurement of micro-PIV (particle image velocimetry). The results show that the released surface energy creates a pair recirculation flow inside the merged droplet when the stationary droplet is placed near the gradient, whereas most released surface energy is converted into oscillation when the stationary droplet is far from the gradient. This distinction is attributed to the motion of the contact line during coalescence. The mixing of fluorescently labeled oligonucleotides in these two modes is revealed with confocal micro-laser induced fluorescence technique. The results of 3D scans demonstrate that the motion of the contact line during coalescence distributes the fluids in a complicated manner, thus beneficial for mixing. This mechanism of enhanced mixing is applicable also for platforms other than a surface with a wettability gradient; prospective applications include improving the mixing of biochemical fluids.