Dairy farming is increasingly affected by the digital revolution. To respond to current challenges—such as environmental, economic, and social sustainability—new technologies must be adopted, entering the perspective of precision livestock farming. This is made possible by the development of countless sensors to be adopted in the barn. The technology that is affecting various aspects of dairy cattle breeding is certainly near infrared spectroscopy (NIRS) which is versatile and can be used online/inline to evaluate and control the critical points of the production process by entering the PAT (process analytical technology). In the barn, NIRS currently can obtain information on the chemical-physical composition of raw materials, total mixed ration (TMR), feces and digestibility, chemical and technological analysis of milk. All this in a short time by eliminating the waiting times for analysis response and costs, allowing an improvement of livestock management. Many studies affirm the validity of NIRS as a reliable and predictive technology against multiple relevant parameters in matrices such as raw feed, TMR, feces, and milk. This review highlights the usefulness of NIRS technology in dairy farm with particular attention to portable instrumentation usable directly on the farm.