Density-functional method for nonequilibrium electron transport. We describe an ab initio method for calculating the electronic structure, electronic transport, and forces acting on the atoms, for atomic scale systems connected to semi-infinite electrodes and with an applied voltage bias. Our method is based on the density-functional theory DFT as implemented in the well tested SIESTA approach which uses nonlocal norm-conserving pseudopotentials to describe the effect of the core electrons, and linear combination of finite-range numerical atomic orbitals to describe the valence states . We fully deal with the atomistic structure of the whole system, treating both the contact and the electrodes on the same footing. The effect of the finite bias including self-consistency and the solution of the electrostatic problem is taken into account using nonequilibrium Green’s functions. We relate the nonequilibrium Green’s function expressions to the more transparent scheme involving the scattering states. As an illustration, the method is applied to three systems where we are able to compare our results to earlier ab initio DFT calculations or experiments, and we point out differences between this method and existing schemes. The systems considered are: i single atom carbon wires connected to aluminum electrodes with extended or finite cross section, ii single atom gold wires, and finally iii large carbon nanotube systems with point defects.