We introduce a spectral density functional theory which can be used to compute energetics and spectra of real strongly--correlated materials using methods, algorithms and computer programs of the electronic structure theory of solids. The approach considers the total free energy of a system as a functional of a local electronic Green function which is probed in the region of interest. Since we have a variety of notions of locality in our formulation, our method is manifestly basis--set dependent. However, it produces the exact total energy and local excitational spectrum provided that the exact functional is extremized. The self--energy of the theory appears as an auxiliary mass operator similar to the introduction of the ground--state Kohn--Sham potential in density functional theory. It is automatically short--ranged in the same region of Hilbert space which defines the local Green function. We exploit this property to find good approximations to the functional. For example, if electronic self--energy is known to be local in some portion of Hilbert space, a good approximation to the functional is provided by the corresponding local dynamical mean--field theory. A simplified implementation of the theory is described based on the linear muffin--tin orbital method widely used in electronic strucure calculations. We demonstrate the power of the approach on the long--standing problem of the anomalous volume expansion of metallic plutonium.