We present a determination of the gluon polarization DeltaG/G in the nucleon, based on the helicity asymmetry of quasi-real photoproduction events, Q2 < 1 (GeV/c)2, with a pair of large transverse-momentum hadrons in the final state. The data were obtained by the COMPASS experiment at CERN using a 160 GeV polarized muon beam scattered on a polarized 6LiD target. The helicity asymmetry for the selected events is A/D = 0.002 ± 0.019(stat) ± 0.003(syst). From this value, we obtain in a leading-order QCD analysis DeltaG/G = 0.024 ± 0.089(stat) ± 0.057(syst) at xg = 0.095 and μ2 ~ 3 (GeV/c)2.