The propagation of an electromagnetic signal in a marine environment cannot be modelled as a plane wave due to the high attenuation in seawater and the interactions with the ocean boundaries. Consequently, conventional beamforming techniques are not applicable for electromagnetic source localization. In this work, the Bayesian approach to matched-field processing is used to localize an electromagnetic source and estimate the environmental parameters. In this formulation, the solution to the inverse problem is given by the a posteriori probability distribution calculated here using the Gibbs sampling method. Bayesian inversion theory provides the formalism for estimating parameters, their uncertainties and verification of the estimates convergence. Two situations were investigated for the case where the single frequency measurements represent the magnitudes of two orthogonal horizontal electric field components: (1) all environmental parameters known and (2) unknown seabed conductivity. The objective function that relates the array data to the propagation model and environment parameters was chosen for the practical situation considered.