Power-law solutions and accelerated expansion in scalar-tensor theories