Beamforming technique can be applied to map the neuronal activities from magnetoencephalographic/electroencephalographic (MEG/EEG) recordings. One of the major difficulties of the scalar-type MEG/EEG beamformer is the determination of accurate dipole orientation, which is essential to an effective spatial filter. This paper presents a new beamforming technique which exploits a maximum contrast criterion to maximize the ratio of the neuronal activity estimated in a specified active state to the activity estimated in a control state. This criterion leads to a closed-form solution of the dipole orientation. Experiments with simulation, phantom, and finger-lifting data clearly demonstrate the effectiveness, efficiency, and accuracy of the proposed method.