Democrats made gains in several traditionally Republican states, while historic victories were recorded in key gubernatorial and congressional races.