The Monte Carlo code PENELOPE has been used to simulate electron beamsfrom a Siemens Mevatron KDS linac with nominal energies of 6, 12 and18 MeV. Owing to its accuracy, which stems from that of the underlyingphysical interaction models, PENELOPE is suitable for simulating problemsof interest to the medical physics community. It includes a geometrypackage that allows the definition of complex quadric geometries, suchas those of irradiation instruments, in a straightforward manner. Dosedistributions in water simulated with PENELOPE agree well withexperimental measurements using a silicon detector and a monitoringionization chamber. Insertion of a lead slab in the incident beam atthe surface of the water phantom produces sharp variations in the dosedistributions, which are correctly reproduced by the simulation code.Results from PENELOPE are also compared with those of equivalentsimulations with the EGS4-based user codes BEAM and DOSXYZ. Angularand energy distributions of electrons and photons in the phase-spaceplane (at the downstream end of the applicator) obtained from bothsimulation codes are similar, although significant differences doappear in some cases. These differences, however, are shown to have anegligible effect on the calculated dose distributions. Variouspractical aspects of the simulations, such as the calculation ofstatistical uncertainties and the effect of the `latent' variance inthe phase-space file, are discussed in detail.