In underwater acoustic localization via matched-field-processing, given a propagation model and a suitable environmental parameterization, one searches for the location (of the transmitter or receiver) whose replica field is closest to the observed one. The high computational complexity of such non-gradient-based optimization methods renders them infeasible for many real-time scenarios, especially when an accurate solution is desired, due to resolution of the search grid required, or as the search dimensionality increases (e.g., when it is necessary to optimize over uncertain environmental parameters such as sound speed or bathymetry). In this work, we propose a ray-based, differentiable model for acoustic propagation for the purpose of a gradient-based optimization for localization. For localization applications in which accurate times of arrivals might not be available, the proposed method can be adapted to work without requiring this information. In such a scenario, it seeks the location (and possibly environmental parameters) that minimize the squared-error between the observed signal and its estimate via the differentiable model. We leverage the PyTorch optimization and auto-differentiation tools for the implementation and demonstrate successful localization on synthetic data inspired from a real-world scenario in a dense multipath environment.