The control and manipulation of the electron spin in semiconductors is central to spintronics1, 2, which aims to represent digital information using spin orientation rather than electron charge. Such spin-based technologies may have a profound impact on nanoelectronics, data storage, and logic and computer architectures. Recently it has become possible to induce and detect spin polarization in otherwise non-magnetic semiconductors (gallium arsenide and silicon) using all-electrical structures3, 4, 5, 6, 7, 8, 9, but so far only at temperatures below 150 K and in n-type materials, which limits further development. Here we demonstrate room-temperature electrical injection of spin polarization into n-type and p-type silicon from a ferromagnetic tunnel contact, spin manipulation using the Hanle effect and the electrical detection of the induced spin accumulation. A spin splitting as large as 2.9 meV is created in n-type silicon, corresponding to an electron spin polarization of 4.6%. The extracted spin lifetime is greater than 140 ps for conduction electrons in heavily doped n-type silicon at 300 K and greater than 270 ps for holes in heavily doped p-type silicon at the same temperature. The spin diffusion length is greater than 230 nm for electrons and 310 nm for holes in the corresponding materials. These results open the way to the implementation of spin functionality in complementary silicon devices and electronic circuits operating at ambient temperature, and to the exploration of their prospects and the fundamental rules that govern their behaviour.