Corneal endothelial cell segmentation of the microscope image is critical for clinical parameters quantification. However, the low-contrast regions are ambiguous and hard to segment. The uncertainty has been proved to be effective for detecting the ambiguous regions. Besides, spatial attention can guide the model to focus on the region of interest during the training process. This paper proposes an Uncertainty Guided Network (UG-Net) for corneal endothelial cell segmentation based on uncertainty estimation and spatial attention. We first use Bayesian approximation to obtain aleatoric and epistemic uncertainty maps. Then, two uncertainty maps are utilized to guide the model to focus on the low-contrast regions with uncertainty-based soft spatial attention. Experimental results show that the proposed method performs better than other state-of-the-art methods.