As prebiotics, galacto-oligosaccharides (GOSs) can improve the intestinal flora and have important applications in medicine. β-galactosidases could promote the synthesis of GOSs in lactose and catalyze the hydrolysis of lactose. In this study, a new β-galactosidase gene (gal2A), which belongs to the glycoside hydrolase family 2, was cloned from marine bacterium Alteromonas sp. QD01 and expressed in Escherichia coli. The molecular weight of Gal2A was 117.07 kDa. The optimal pH and temperature of Gal2A were 8.0 and 40 °C, respectively. At the same time, Gal2A showed wide pH stability in the pH range of 6.0–9.5, which is suitable for lactose hydrolysis in milk. Most metal ions promoted the activity of Gal2A, especially Mn2+ and Mg2+. Importantly, Gal2A exhibited high transglycosylation activity, which can catalyze the formation of GOS from milk and lactose. These characteristics indicated that Gal2A may be ideal for producing GOSs and lactose-reducing dairy products.