Limited to the low spatial resolution of the hyperspectral imaging sensor, mixed pixels are inevitable in hyperspectral images. Therefore, to obtain the endmembers and corresponding fractions in mixed pixels, hyperspectral unmixing becomes a hot spot in the field of remote sensing. Endmember spectral variability (ESV), which is common in hyperspectral images, affects spectral unmixing accuracy. This paper proposes a spectral unmixing method based on maximum margin criterion and derivative weights (MDWSU) to reduce the effect of ESV on spectral unmixing. Firstly, in the MDWSU model, an effective and fast algorithm is employed for establishing the endmember spectral library. Then a spectral weighting matrix based on the maximum margin criterion is constructed based on the endmember spectral library. Besides, derivative analysis and local neighborhood weights are merged into local neighborhood derivative weights, which act as a regularization term to penalize different abundance vectors. Local neighborhood derivative weights and spectral weighting matrix are proved to reduce the effect of ESV. Real hyperspectral data experiments show that the MDWSU model can obtain more accurate endmembers and abundance estimation. In addition, the experimental results, including the spectral angle distance and the root mean square error, prove the superiority of the MDWSU model over the previous methods.