Optics and photonics are exciting, rapidly developing fields building their success largely on use of more and more elaborate artificially made, nanostructured materials. To further advance our understanding of light-matter interactions in these complicated artificial media, numerical modeling is often indispensable. This thesis presents the development of rigorous finite-difference method, a very general tool to solve Maxwell’s equations in arbitrary geometries in three dimensions, with an emphasis on the frequency-domain formulation. Enhanced performance of the perfectly matched layers is obtained through free space squeezing technique, and nonuniform orthogonal grids are built to greatly improve the accuracy of simulations of highly heterogeneous nanostructures. Examples of the use of the finite-difference frequency-domain method in this thesis range from simulating localized modes in a three-dimensional photonic-crystal membrane-based cavity, a quasi-one-dimensional nanobeam cavity and arrays of side-coupled nanobeam cavities, to modeling light propagation through metal films with single or periodically arranged multiple subwavelength slits.