A line integration method is presented in this paper for evaluation of domain integrals in 3D problems. The method is a boundary-only discretization method and the domain integrals can be computed by sum of integrals on one-dimensional straight lines. Divergence theorem is used to transform the domain integrals into boundary integrals with one-dimensional integrals. The boundary integrals can be evaluated by boundary elements with integral points. Each integral point can be used to construct an integral line, and the domain integrals can be finally computed by line integrals on integral lines. Only the boundary discretization is needed and background cells are used to cut the integral lines into sub-lines to obtain the desired accuracy. The method is proved and applied in boundary element method for 3D potential and elasticity problems. Numerical examples have demonstrated the accuracy of the proposed method.