The first measurement of e+e− pair production at mid-rapidity (|ηe| < 0.8) in pp collisions at s=7 TeV with ALICE at the LHC is presented. The dielectron production is studied as a function of the invariant mass (mee < 3.3 GeV/c2), the pair transverse momentum (pT,ee < 8 GeV/c), and the pair transverse impact parameter (DCAee), i.e., the average distance of closest approach of the reconstructed electron and positron tracks to the collision vertex, normalised to its resolution. The results are compared with the expectations from a cocktail of known hadronic sources and are well described when PYTHIA is used to generate the heavy-flavour contributions. In the low-mass region (0.14 < mee < 1.1 GeV/c2), prompt and non-prompt e+e− sources can be separated via the DCAee. In the intermediate-mass region (1.1 < mee < 2.7 GeV/c2), a double-differential fit to the data in mee and pT,ee and a fit of the DCAee distribution allow the total c c ¯ and b b ¯ cross sections to be extracted. Two different event generators, PYTHIA and POWHEG, can reproduce the shape of the two-dimensional mee and pT,ee spectra, as well as the shape of the DCAee distribution, reasonably well. However, differences in the c c ¯ and b b ¯ cross sections are observed when using the generators to extrapolate to full phase space. Finally, the ratio of inclusive to decay photons is studied via the measurement of virtual direct photons in the transverse-momentum range 1 < pT < 8 GeV/c. This is found to be unity within the statistical and systematic uncertainties and consistent with expectations from next-to-leading order perturbative quantum chromodynamic calculations.[Figure not available: see fulltext.].