We study compactness and boundedness of embeddings from Sobolev type spaces on metric spaces into Lq spaces with respect to another measure. The considered Sobolev spaces can be of fractional order and some statements allow also nondoubling measures. Our results are formulated in a general form, using sequences of covering families and local Poincaré type inequalities. We show how to construct such suitable coverings and Poincaré inequalities. For locally doubling measures, we prove a self-improvement property for two-weighted Poincaré inequalities, which applies also to lower-dimensional measures.We simultaneously treat various Sobolev spaces, such as the Newtonian, fractional Hajłasz and Poincaré type spaces, for rather general measures and sets, including fractals and domains with fractal boundaries. By considering lower-dimensional measures on the boundaries of such domains, we obtain trace embeddings for the above spaces. In the case of Newtonian spaces we exactly characterize when embeddings into Lq spaces with respect to another measure are compact. Our tools are illustrated by concrete examples. For measures satisfying suitable dimension conditions, we recover several classical embedding theorems on domains and fractal sets in Rn.