Heat shock proteins (HSPs) are ubiquitous protective proteins that play crucial roles in plant development and adaptation to stress, and the aim of this study is to characterize the HSP gene in alfalfa. Here we isolated a small heat shock protein gene (MsHSP17.7) from alfalfa by homology-based cloning. MsHSP17.7 contains a 477-bp open reading frame and encodes a protein of 17.70-kDa. The amino acid sequence shares high identity with MtHSP (93.98 %), PsHSP17.1 (83.13 %), GmHSP17.9 (74.10 %) and SlHSP17.6 (79.25 %). Phylogenetic analysis revealed that MsHSP17.7 belongs to the group of cytosolic class II small heat shock proteins (sHSP), and likely localizes to the cytoplasm. Quantitative RT-PCR indicated that MsHSP17.7 was induced by heat shock, high salinity, peroxide and drought stress. Prokaryotic expression indicated that the salt and peroxide tolerance of Escherichia coli was remarkably enhanced. Transgenic Arabidopsis plants overexpressing MsHSP17.7 exhibited increased root length of transgenic Arabidopsis lines under salt stress compared to the wild-type line. The malondialdehyde (MDA) levels in the transgenic lines were significantly lower than in wild-type, although proline levels were similar between transgenic and wild-type lines. MsHSP17.7 was induced by heat shock, high salinity, oxidative stress and drought stress. Overexpression analysis suggests that MsHSP17.7 might play a key role in response to high salinity stress.Electronic supplementary materialThe online version of this article (doi:10.1007/s11033-016-4008-9) contains supplementary material, which is available to authorized users.