Yahoo Inc. reached inside the ranks of rival Google Inc. in its latest changing of the guard, appointing longtime Web-search executive Marissa Mayer as its new chief and returning the struggling Internet company to a leader with deep technology experience.

The appointment showed how Yahoo, a onetime pioneer of Web search and online advertising, is going back to its Silicon Valley Internet roots.

Yahoo's...