As the Civil War raged and casualties mounted, public sentiment in the North tilted dangerously toward allowing Southern secession. Outright Confederate military victory was never a practical goal, but breaking Union resolve was plausible and nearly happened -- the South, after all, was fighting for a homeland and a way of life, while the North fought for an abstract notion of Union. Lincoln had the courage to insist on preserving a Union that even a majority of his own citizens were eventually willing to dissolve. His 1864 re-election was the turning point that showed the Rebels that simply surviving until Northern resolve withered was not going to work. From that point on, the Confederacy's cause was doomed. (CW computer games frequently use the 1864 election as their ending; if the Confederate player can break Union morale sufficiently to prevent Lincoln's reelection, then the South wins).
Slavery was a side issue in the Civil War. Lincoln resisted the Abolitionist cause until he desperately needed the support of that large voting bloc. Embracing Abolition meant that Lincoln could inspire his countrymen with a goal that seemed loftier than maintaining a political status quo.
Lincoln's reconstruction philosophy, "with malice toward none", was equally important in reuniting the nation. Few will argue that the re-imposition of Northern rule was entirely benevolent. Nonetheless, it was Lincoln's dictum that the South should not be punished as a conquered enemy.
Lincoln did intend to deport the slave population to Liberia after the war, or so I have read, and was dissuaded only by the enormous cost and formidable logistics. Whether this was or was not motivated by racism, it is unfair to judge historical actions and opinions by the standards of modern morality.
At any rate, America's persistence as a united nation led to its strength upon entering WWII (less than 80 years after the War Between the States ended, mind you) and its position of dominance in the world today. Whether or not you approve of the United States' modern position of leadership, I think you will admit that the outcome of WWII, and the subsequent struggle against communism, would've turned out quite differently had there not been a strong United States of America to take part in those events. For that, you can thank Mr. Lincoln. And for that reason, he is certainly among the greatest of all American leaders, if not THE greatest.