  Although the optical colour-magnitude diagram of galaxies allows one to
select red sequence objects, neither can it be used for galaxy classification
without additional observational data such as spectra or high-resolution
images, nor to identify blue galaxies at unknown redshifts. We show that adding
the near ultraviolet colour to the optical CMD reveals a tight relation in the
three-dimensional colour-colour-magnitude space smoothly continuing from the
"blue cloud" to the "red sequence". We found that 98 per cent of 225,000
low-redshift (Z<0.27) galaxies follow a smooth surface g-r=F(M,NUV-r) with a
standard deviation of 0.03-0.07 mag making it the tightest known galaxy
photometric relation. There is a strong correlation between morphological types
and integrated NUV-r colours. Rare galaxy classes such as E+A or tidally
stripped systems become outliers that occupy distinct regions in the 3D
parameter space. Using stellar population models for galaxies with different
SFHs, we show that (a) the (NUV-r, g-r) distribution is formed by objects
having constant and exponentially declining SFR with different characteristic
timescales; (b) colour evolution for exponentially declining models goes along
the relation suggesting its weak evolution up-to a redshift of 0.9; (c)
galaxies with truncated SFHs have very short transition phase offset from the
relation thus explaining the rareness of E+A galaxies. This relation can be
used as a powerful galaxy classification tool when morphology remains
unresolved. Its mathematical consequence is the photometric redshift estimates
from 3 broad-band photometric points. This approach works better than most
existing photometric redshift techniques applied to multi-colour datasets.
Therefore, the relation can be used as an efficient selection technique for
galaxies at intermediate redshifts (0.3<Z<0.8) using optical imaging surveys.
