Stacking of multichannel seismic reflection data is a crucial step in seismic data processing, usually leading to the first interpretable seismic image. Stacking is preceded by traveltime correction, in which all events contained in a common-midpoint (CMP) gather are corrected for their offset-dependent traveltime increase. Such corrections are often based on the assumption of hyperbolic traveltime curves, and a best fit hyperbola is usually sought for each reflection by careful determination of stacking velocities. However, assuming hyperbolic traveltime curves is not accurate in many situations, e.g., in the case of strongly curved reflectors, large offset-to-target-ratios, or strong anisotropy. Here, we found that an underlying model parameterizing the shape of the traveltime curve is not a strict necessity for producing high-quality stacks. Based on nonrigid image-matching techniques, we developed an alternative way of stacking, both independent of a reference velocity model and any prior assumptions regarding the shape of the traveltime curve. Mathematically, our stacking operator is based on a variational approach that transforms a series of seismic traces contained within a CMP gather into a common reference frame. Based on the normalized crosscorrelation and regularized by penalizing irregular displacements, time shifts are sought for each sample to minimize the discrepancy between a zero-offset trace and traces with larger offsets. Time shifts are subsequently exported as a data attribute and can easily be converted to stacking velocities. To demonstrate the feasibility of this approach, we apply it to simple and complex synthetic data and finally to a real seismic line. We find that our new method produces stacks of equal quality and velocity models of slightly better quality compared with an automated, hyperbolic traveltime correction and stacking approach for complex synthetic and real data cases.