{it Ab initio} computational methods for electronic transport in nanoscaled systems are an invaluable tool for the design of quantum devices. We have developed a flexible and efficient algorithm for evaluating $I$-$V$ characteristics of atomic junctions, which integrates the non-equilibrium Greens function method with density functional theory. This is currently implemented in the package {it Smeagol}. The heart of {it Smeagol} is our novel scheme for constructing the surface Greens functions describing the current/voltage probes. It consists of a direct summation of both open and closed scattering channels together with a regularization procedure of the Hamiltonian, and provides great improvements over standard recursive methods. In particular it allows us to tackle material systems with complicated electronic structures, such as magnetic transition metals. Here we present a detailed description of {it Smeagol} together with an extensive range of applications relevant for the two burgeoning fields of spin and molecular-electronics.