This work is concerned with the inverse problem for ocean acoustics modeled by a multilayered waveguide with a finite depth. We provide explicit formulae to locate the layers, including the seabed, and reconstruct the speed of sound and the densities in each layer from measurements collected on the surface of the waveguide. We proceed in two steps. First, we use Gaussian type excitations on the upper surface of the waveguide and then from the corresponding scattered fields, collected on the same surface, we recover the boundary spectral data of the related 1D spectral problem. Second, from these spectral data, we reconstruct the values of the normal derivatives of the singular solutions, of the original waveguide problem, on that upper surf...