The overall aim of this thesis is the development of novel electroencephalography (EEG) and magnetoencephalography (MEG) analysis methods to provide new insights to the functioning of the human brain. MEG and EEG are non-invasive techniques that measure outside of the head the electric potentials and the magnetic fields induced by the neuronal activity, respectively. The objective of these functional brain imaging modalities is to be able to localize in space and time the origin of the signal measured. To do so very challenging mathematical and computational problems needs to be tackled. The first part of this work proceeds from the biological origin the M/EEG signal to the resolution of the forward problem. Starting from Maxwell's equations in their quasi-static formulation and from a physical model of the head, the forward problem predicts the measurements that would be obtained for a given configuration of current generators. With realistic head models the solution is not known analytically and is obtained with numerical solvers. The first contribution of this thesis introduces a solution of this problem using a symmetric boundary element method (BEM) which has an excellent precision compared to alternative standard BEM implementations. Once a forward model is available the next challenge consists in recovering the current generators that have produced the measured signal. This problem is referred to as the inverse problem. Three types of approaches exist for solving this problem: parametric methods, scanning techniques, and image-based methods with distributed source models. This latter technique offers a rigorous formulation of the inverse problem without making strong modeling assumptions. However, it requires to solve a severely ill-posed problem. The resolution of such problems classically requires to impose constraints or priors on the solution. The second part of this thesis presents robust and tractable inverse solvers with a particular interest on efficient convex optimization methods using sparse priors. The third part of this thesis is the most applied contribution. It is a detailed exploration of the problem of retinotopic mapping with MEG measurements, from an experimental protocol design to data exploration, and resolution of the inverse problem using time frequency analysis. The next contribution of this thesis, aims at going one step further from simple source localization by providing an approach to investigate the dynamics of cortical activations. Starting from spatiotemporal source estimates the algorithm proposed provides a way to robustly track the "hot spots" over the cortical mesh in order to provide a clear view of the cortical processing over time. The last contribution of this work addresses the very challenging problem of single-trial data processing. We propose to make use of recent progress in graph-based methods in order to achieve parameter estimation on single-trial data and therefore reduce the estimation bias produced by standard multi-trial data averaging. Both the source code of our algorithms and the experimental data are freely available to reproduce the results presented. The retinotopy project was done in collaboration with the LENA team at the hôpital La Pitié-Salpêtrière (Paris).