The first measurement at the LHC of charge-dependent directed flow (v1) relative to the spectator plane is presented for Pb-Pb collisions at sNN=5.02 TeV. Results are reported for charged hadrons and D0 mesons for the transverse momentum intervals pT>0.2 GeV/c and 3<6 GeV/c in the 5%-40% and 10%-40% centrality classes, respectively. The difference between the positively and negatively charged hadron v1 has a positive slope as a function of pseudorapidity η, dΔv1/dη=[1.68±0.49(stat)±0.41(syst)]×10-4. The same measurement for D0 and D¯0 mesons yields a positive value dΔv1/dη=[4.9±1.7(stat)±0.6(syst)]×10-1, which is about 3 orders of magnitude larger than the one of the charged hadrons. These measurements can provide new insights into the effe...