This is the first introductory textbook on quantum field theory in gravitational backgrounds intended for undergraduate and beginning graduate students in the fields of theoretical astrophysics, cosmology, particle physics, and string theory. The book covers the basic (but essential) material of quantization of fields in an expanding universe and quantum fluctuations in inflationary spacetime. It also contains a detailed explanation of the Casimir, Unruh, and Hawking effects, and introduces the method of effective action used for calculating the back-reaction of quantum systems on a classical external gravitational field. The broad scope of the material covered will provide the reader with a thorough perspective of the subject. Every major result is derived from first principles and thoroughly explained. The book is self-contained and assumes only a basic knowledge of general relativity. Exercises with detailed solutions are provided throughout the book.