This book explores the mathematical foundations of neural computation through the statistical mechanics of disordered systems, with particular emphasis on spin glasses. It develops the idea that learning, memory, and inference are collective phenomena, arising not from the sophistication of individual components but from the interaction of many simple units. It covers: the foundations of probability theory and statistical mechanics, as well as Monte Carlo numerical methods; ; the statistical mechanics of spin glasses and disordered systems in general, considered from both physical and rigorous mathematical perspectives; ; classical models of neural networks and associative memories, the Hopfield model, time-series analysis, and self-organising maps; ; contemporary theories of deep learning, and applications of statistical mechanics to the most recent developments in artificial intelligence. ; An appendix offers distinct reading paths for readers arriving from physics, mathematics, or computer science, so that the book can be used equally as a graduate course, a self-study text, or a reference.