The right and far-right parties in Spain are poised to gain an absolute majority in parliament as the election results are counted.