Viner, who has also been editor-in-chief of Guardian US since last summer, will take over from Alan Rusbridger when he steps down this summer.
There were 26 applicants for the role, according to Guardian Media Group’s owner The Scott Trust, which made the appointment.
Viner has been deputy editor of The Guardian since 2008. She joined the newspaper as a writer in 1997 and has since undertaken several roles including editor of Weekend magazine, features editor and Saturday editor. In May 2013, she launched the Guardian Australia as editor-in-chief.
Before joining The Guardian, Viner worked at The Sunday Times in London. She was on the board of London's Royal Court theatre for 13 years and judged the Orange prize in 2006.
Liz Forgan, chair of The Scott Trust, said: "Katharine shone through in what was a tremendously strong line-up of candidates. In her 18 years at The Guardian she has done almost every editorial job in the organisation, including running Guardian US and Guardian Australia, and has shown herself to be an inspiring and courageous leader.
"She has embraced the huge changes in the industry with creativity and relish while bringing with her a deep commitment to The Guardian's traditions of plural, liberal journalism. The Scott Trust is confident that Katharine, building on the extraordinary achievements of Alan Rusbridger, is the right person to lead The Guardian and The Observer as we expand on new platforms and in new markets."
Viner said: "Being editor-in-chief of The Guardian and Observer is an enormous privilege and responsibility, leading a first class team of journalists revered around the world for outstanding reporting, independent thinking, incisive analysis and digital innovation. I am honoured to succeed Alan Rusbridger, whose remarkable tenure will be remembered for prize-winning journalism and pioneering advances in The Guardian’s global reach.
"Building on his track record, I intend to lead a media organisation that is bold, challenging, open and engaging. It will be a home for the most ambitious journalism, ideas and events, setting the agenda and reaching out to readers all around the world."
Rusbridger said: "Kath rose up through The Guardian as an inspired magazine and features editor. She took Australia by storm before heading up The Guardian’s American operation. She will bring immense experience, flair, warmth, imagination and formidable energy to her new role as editor of The Guardian."