Metamaterials are a new class of artificial materials that can be engineered to possess properties that would be difficult or even impossible to find in nature. Metamaterials have brought about the advent of a great number of new photonic devices with amazing properties. Two of the most important ones are negative index media (NIMs), with which it is possible to build superlenses whose resolution is not limited by diffraction unlike in conventional lenses, and the devices based on transformation optics, a new theory within electromagnetism that allows us to know the properties that a medium should have in order to curve or distort electromagnetic space. As a consequence, it has been possible to create astonishing devices such as invisibility cloaks and optical black holes. Due to their importance, in this work we have focused on these two applications of metamaterials. In the case of negative index media, we have studied how these can be built upon extraordinary transmission structures. As a main outcome, a novel multilayer high-performance NIM metamaterial exhibiting a high figure of merit (significantly larger than those of previous works) in the visible spectrum has been designed and experimentally verified. The structure also presents polarization independence and homogeneous properties for normal incidence. This demonstration entails the first experimental low-loss NIM in the visible regime and also the first one made up of several unit cells along the propagation direction, an important step towards homogeneous NIMs in this band. This work has been recognized as one of the latest milestones in three-dimensional optical metamaterials. Moreover, it has been shown by other authors that the properties of this structure can be employed to control the propagation velocity (subluminal and superluminal) of a femtosecond laser pulse or to achieve subpicosecond optical switching. Along other line, we have introduced the concept of optical security based on strong artificial magnetism at optical frequencies. This exotic property could act as an exclusive optical fingerprint that can be easily identified from proper measurements and only reproducible with the most advanced nanofabrication techniques, thus adding a higher level of security and enormously reducing the possibility of counterfeiting. Suitable structures displaying unusually high magnetic responses in this regime have been proposed as well. Unlike the majority of applications based on metamaterials, optical security could become a real application and reach the market in the short-term, since the required fabrication techniques would be comparatively less demanding. Concerning transformation optics, we have worked on the development and applicationof design methodologies that simplify the constitutive parameters required for the implementation of transformation media, and thus facilitate the design and fabrication stages of the metamaterials needed to synthesize transformation-optics-based devices. In this sense, we have followed two different approaches. The first consists on the minimization of the anisotropy resulting from the transmutation of singularities of optical elements based on the idea of partial transmutation, which eliminates the need for resonant elements in their implementation. This could turn into reality interesting devices such as broadband invisibility cloaks, which otherwise would be difficult to realize. On the other hand, we have applied the concept of quasi-conformal mapping to design realizable devices, such as isotropic optical squeezers and radiation-pattern-shaping devices that allow us to achieve complex patterns in a simple way. Finally, we have studied in depth some aspects of the theory of transformation optics and developed interesting devices from it, which could find application in the field of highspeed processing and networking. These include ultra-short perfect couplers for high-index nanophotonic waveguides, completely flat reflectionless hyperlenses, couplers for metallic waveguides with different cross-section and devices that couple free-space light to surface plasmon polaritons along non-patterned metallic surfaces with angular bandwidths considerably higher than those of conventional couplers.