Water in its various forms is one of the most important materials existing today. Despite extensive research, there are still many open questions regarding the properties of pure and salty water, e.g. if solvated ions affect hydrogen bonding in water beyond the first solvation shell. Molecular-dynamics simulations provide plenty of useful information about the microscopic structure of water and solutions. In molecular dynamics, several dozens of molecules repeated periodically are allowed to evolve according to the laws of classical mechanics. The forces acting on atoms can be either determined by empirical fits to experimental data or obtained from electronic structure calculations. The latter approach, called first-principles molecular dynamics, requires solving density-functional-theory equations at each simulation step, and is much more expensive than the approach relying on empirical fits. With ever increasing computational powers, first-principles simulations become practical, giving access to more accurate and consistent description of various interactions in the system. In this talk, I will present some of my recent research on simulations of liquid water, ice, and aqueous solutions of salts. I will explain how the use of state-of-the-art petaflop systems enables us to compute bulk properties of water such as its density, from first principles. I will also show how modern approximations improve the description of structure and electronic properties of water and solutions of salts.